#pragma data_seg(".share") int i=0; #pragma data_seg() #pragma comment(linker,"/section:.share,RWS") Note: 1、变量必须初始化,否则会放到.bss节中 2、同一位置上的文件才能共享