Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mangle dll exported names with DEF file

I'm trying to create a proxy dll and ran into this issue. Suppose I have following files:

a.cpp:

extern "C" int __declspec(dllexport) func(int x) {return x;}

a.def:

EXPORTS
func
??4Test@@QAEAAU0@ABU0@@Z = func

Then I run:

cl /c c.cpp
link /RELEASE /DLL /DEF:c.def /OUT:c.dll c.obj

Output of dumpbin /exports c.dll shows that following symbols are exported: func ??4Test

Where is the rest of the "Test" exported name? And is there any way to get it back?

like image 925
Eugene Pakhomov Avatar asked Feb 03 '26 10:02

Eugene Pakhomov


1 Answers

Give this a shot instead, without using a DEF file:

extern "C" __declspec(dllexport) int __cdecl func(int x) {return x;}

Now it shouldn't mangle the function name at all.

like image 136
austere Avatar answered Feb 05 '26 02:02

austere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!