Search code examples
c++dllexportname-decoration

How do I change the exported name decoration for __stdcall in VC++?


This is how I have my export function declared at the moment:

extern "C" __declspec(dllexport)
Iexport_class* __stdcall GetExported_Class();

When VS2008 compiled the source for this, the dll produced contains this under its export table:

_GetExported_Class@0

For compatibility with other compilers I need the above decoration to look like this instead:

GetExported_Class

Changing the calling convention to __cdecl will decorate it to the way I want but the convention would be wrong so I can't use that. I need it to be decorated the way __cdecl looks but uses __stdcall instead.

Is there anyway to do this without using a .def file? Is there a switch or an option I can pass to the link.exe linker that can make it decorate the export name to the way I want?

Thanks


Solution

  • No. All __stdcall names are decorated this way. I'm amazed that you have some other compiler that won't expect __stdcall exports to be decorated like this. Overriding the linker with .def is pretty much all you can do- unless you want to alter the PE file after production.