Visual Stidio 2015#注释注释(链接器,“ / EXPORT选项

时间:2018-10-04 05:47:15

标签: visual-c++ visual-studio-2015

Visual Stuio 2015 #pragma comment(linker, "/EXPORT  options

迁移到X64后,我必须删除以下编译指示

#pragma comment(linker,"/EXPORT:DllCanUnloadNow=_DllCanUnloadNow@0,PRIVATE")
#pragma comment(linker,/EXPORT:DllGetClassObject=_DllGetClassObject@12,PRIVATE")
#pragma comment(linker, "/EXPORT:DllRegisterServer=_DllRegisterServer@0,PRIVATE")
#pragma comment(linker, "/EXPORT:DllUnregisterServer=_DllUnregisterServer@0,PRIVATE")

要解决以下未解决的外部符号:

1>NmsCmCommon.exp : error LNK2001: unresolved external symbol _DllCanUnloadNow@0
1>NmsCmCommon.exp : error LNK2001: unresolved external symbol _DllGetClassObject@12
1>NmsCmCommon.exp : error LNK2001: unresolved external symbol _DllRegisterServer@0
1>NmsCmCommon.exp : error LNK2001: unresolved external symbol _DllUnregisterServer@0

这些实用工具是做什么用的,如果将它们删除,会发生什么问题?

1 个答案:

答案 0 :(得分:1)

现在我看到了没有pagmas的问题

pragma comment(linker,"/EXPORT:DllCanUnloadNow=_DllCanUnloadNow@0,PRIVATE")
pragma comment(linker,/EXPORT:DllGetClassObject=_DllGetClassObject@12,PRIVATE")
pragma comment(linker, "/EXPORT:DllRegisterServer=_DllRegisterServer@0,PRIVATE")
pragma omment(linker,"/EXPORT:DllUnregisterServer=_DllUnregisterServer@0,PRIVATE")

没有它们的需要就无法向regsv32注册我的dll,因为缺少llRegisterServer函数-所以我必须实现此Function bot,为什么它仅适用于X86而不适用于X64,即使其中没​​有源更改且只有一些适应项目的