DLL共享数据部分不存在错误 [英] DLL Shared Data Section Does Not Exist Error
本文介绍了DLL共享数据部分不存在错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#pragma data_seg(。shared)
int varx = 0;
#pragma data_seg()
__declspec(allocate(。shared))
//我在另一个论坛中发现这个declspec建议
#pragma comment(linker,/ section :.shared,RWS)
另外我添加
SECTIONS
.shared READ WRITE SHARED
进入def文件。但是我总是得到:
链接:警告LNK4039:用SECTION选项指定的部分.shared不存在
错误。如果我只做一个(.def或pragma注释)只得到一个,如果两个都有两个错误。
我想念的任何东西
解决方案
只看到declspec以这种方式使用:
__declspec(allocate(。shared))int varx = 0;
我会尝试只写这个:
#pragma comment(link,/ section:.shared,RWS)
__declspec(allocate(。shared))int varx =
避免声明空部分或多重定义的一个
I try to declare a shared data segment in a DLL. I declare the area with:
#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")
Also I add
SECTIONS
.shared READ WRITE SHARED
into the def file. However I always get:
LINK : warning LNK4039: section '.shared' specified with /SECTION option does not exist
error. If I do only one (.def or pragma comment) get only one, if do both get two errors.
Anything I miss?
解决方案
Ive only seen that declspec used in this way:
__declspec(allocate(".shared")) int varx=0;
I would try writting only this:
#pragma comment (linker,"/section:.shared,RWS")
__declspec(allocate(".shared")) int varx=0;
avoiding declaring an empty section or a multiply defined one
这篇关于DLL共享数据部分不存在错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文