views:

309

answers:

2

Hi,

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 getting 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.

A: 

Are you actually using the .def file?

Can we see your command line to compile?

Alex
I'll try and put it up. Before I wasn't getting any exports, so I went into my linker options and added a /DEF option.
mmoran
Make sure you're building the configuration you think you are.
Alex
I have it set to Release
mmoran
A: 

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.

mmoran