GCC exports decorated function name only from dll

Posted by Jeff McClintock on Stack Overflow See other posts from Stack Overflow or by Jeff McClintock
Published on 2010-03-24T05:36:38Z Indexed on 2010/03/24 5:43 UTC
Read the original article Hit count: 317

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about c++

Related posts about gcc