VS2017 共享节问题
需要dll间共享数据,看了http://www.cnblogs.com/CBDoctor/archive/2013/01/26/2878201.html,尝试了下,使用def文件添加共享节
SECTION
myseg READ WRITE SHARED
发现VS2017编译出来没有共享节,查看编译警告:
1>Source.def(3): warning LNK4017: SECTION 语句不支持目标平台;已忽略
1>Source.def(4): warning LNK4017: myseg 语句不支持目标平台;已忽略
再查看一下msdn:
Linker Tools Warning LNK4017 keyword statement not supported for the
target platform; ignored The given module-definition statement is not
supported by this version of the linker tools. The tool ignored the
statement in the .def file.For example, using DESCRIPTION in a .def file and not also using the
/VXD linker option will generate this warning.
当前编译的平台v140太高了,链接器已经不支持def文件里的section关键字了,遂改成
#pragma comment(linker,"/SECTION:myseg,RWS")
编译无警告,共享节生效