【发布时间】:2012-04-13 04:06:41
【问题描述】:
我尝试在 DLL 中声明一个共享数据段。我用以下方式声明该区域:
#pragma data_seg(".shared")
int varx=0;
#pragma data_seg()
__declspec(allocate(".shared"))
// I found this declspec suggestion in another forum
#pragma comment (linker,"/section:.shared,RWS")
我也加了
SECTIONS
.shared READ WRITE SHARED
到 def 文件中。但是我总是得到:
LINK : warning LNK4039: section '.shared' specified with /SECTION option does not exist
错误。如果我只做一个(.def 或 pragma 注释)只会得到一个,如果两者都得到两个错误。
有什么我想念的吗?
【问题讨论】: