开发者

name mangling with def file and extern "C"

开发者 https://www.devze.com 2022-12-14 04:44 出处:网络
I\'m creating a basic COM component so I can practice creating them. I\'m exporting DllRegisterServer, DllUnregisterServer,DllGetClassObject and DllCanUnloadNow from a .def file with the PRIVATE keyw

I'm creating a basic COM component so I can practice creating them.

I'm exporting DllRegisterServer, DllUnregisterServer,DllGetClassObject and DllCanUnloadNow from a .def file with the PRIVATE keyword(I think Microsoft requires it).

Anway, I specified all 4 functions with extern "C" and yet I'm still gettin开发者_运维知识库g mangling. Here is my .def:

EXPORTS
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE

Here is the mangling from dumpbin /EXPORTS

_DllCanUnloadNow@0
_DllGetClassObject@12
_DllRegisterServer@0
_DllUnregisterServer@0

I know the extern "C" helps, because I get really bad mangling without it, but I thought the .def with extern "C" was supposed to get rid of name mangling?

My compiler is VC++ Express 2008. Linker Command Line:

/OUT:"G:\Programming\COM\BasicMathCOM\BasicMath\Release\BasicMath.dll" /INCREMENTAL:NO /NOLOGO /DLL /MANIFEST /MANIFESTFILE:"Release\BasicMath.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"g:\Programming\COM\BasicMathCOM\BasicMath\Release\BasicMath.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

+/DEF:BasicMath.def, which I had added under additional options.


Are you actually using the .def file?

Can we see your command line to compile?


Sorry, I fixed it. When I was copying the command line into my question I saw a /DEBUG even though I had set the Release Configuration. I saw that the Generate Debugging Info had been inadvertently turned on, so I disabled it and re-compiled. The name mangling is gone.

Thanks for your help.

0

精彩评论

暂无评论...
验证码 换一张
取 消