tags:

views:

176

answers:

1

Hi Guys, I have a dll, it exports a function...

extern "C"
int __stdcall
MP_GetFactory( gmpi::IMpUnknown** returnInterface )
{
}

I compile this with Code::Blocks GCC compiler (V3.4.5). Problem: resulting dll exports decorated function name...

MP_GetFactory@4

This fails to load, should be plain old...

MP_GetFactory

I've researched this for about 4 hours. I think --add-stdcall-alias is the option to fix this. My Code::Blocks log shows...

mingw32-g++.exe -shared -Wl,--out-implib=bin\Debug\libGainGCC.a -Wl,--dll obj\Debug\se_sdk3\mp_sdk_audio.o obj\Debug\se_sdk3\mp_sdk_common.o obj\Debug\Gain\Gain.o obj\Debug\Gain\gain.res -o bin\Debug\GainGCC.sem --add-stdcall-alias -luser32

..so I think that's the correct option in there? But no luck. Dependancy Walker show only the decorated name being exported. I got It to kinda work by using __cdecl instead of __stdcall, the name is then exported ok, but the function corrupts the stack when called (because the caller expected the other calling convention).

+1  A: 

Sorry to answer my own question, finally figured it out.

Project/Build Options/Linker/Other Linker Options -Wl,--kill-at

...kills the decoration '@' symbol etc.

Jeff McClintock