Reputation: 31
Due to specific needs i need to create a DLL which exports a function that is named in a specific way, it's also mangled.
?drawGdi@stop@234@@Z
Is there anyway of accomplishing this?
Upvotes: 0
Views: 170
Reputation: 1
Can't you declare your function like e.g.
class myclass;
extern "C" void my_function(int,myclass&);
Then it should be exported as my_function
(at least on Posix systems; I guess it is the same on Windows, but I don't know).
If compiling with GCC, you could use Asm Labels. Then any name acceptable by the assembler should be ok.
On Linux with ELF executables you probably could not, as David Schwartz suggested, simply edit the binary file (because that would probably break some hash-table used in ELF for symbols).
Upvotes: 1
Reputation: 98398
You can do that, but you have to write a DEF file.
extern "C" declspec(dllexport) void foo(int);
EXPORTS
?drawGdi@stop@234@@Z=_foo
(_foo
is the exported name of the function).
Remember to specify the DEF file when linking the DLL, of course.
For more details see the documentation on DEF files.
Upvotes: 2