I'm trying to build a project I have and it has several exported functions. The functions follow the stdcall convention and they get mangled if compiled with GCC as
Func@X
Other compilers mangle the name like this:
_Func@X
Is any way I can force GCC to mangle the names of the exported functions to the later example?
See this answer.
int Func() __asm__("_Func@X");
This will force GCC to name the symbol _Func@X
regardless of what it would have done normally.
Oh right, @
is special: it's used for symbol versioning. I thought that __asm__("...@...")
used to work, but I guess it doesn't anymore.
int Func() __asm__("_Func");
__asm__(".symver _Func, _Func@X");
This must be accompanied by a version script file, like:
1 {
global:
_Func;
};
given to gcc -Wl,--version-script=foo.version
when linking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With