On 7/18/2011 10:40 PM, Andrej Mitrovic wrote:
You have several problems.
extern(C++) only specifies the calling convention, not the visibility
of the symbol. To export the symbol, list it in a .def file or mark
the function with export in the module itself, ala:
export extern(C++) void SetInt(int * foo) {}
If you export it like this, it will be exported as the C++ mangled name.
If you have extern(C) it will be cdecl "_SetInt" and extern(Windows)
will be stdcall "_SetInt@4".
I don't know why, but if you use a .def file instead of `export` the
function will be exported as a C function with no name mangling.
If you look at dumpbin /exports you'll see something like this:
ordinal hint RVA name
1 0 0000306C SetInt = ?SetInt@@YAXPAH@Z (void __cdecl
SetInt(int *))
So the symbol still has C++ name mangling but its exported as whatever
name you want.