Re: Names of C functions exported from a dll
On Mon, 02 Jan 2012 14:06:36 +0100, Martin Drasar wrote: Hi everybody, I wanted to ask if there is any specific reason why the name of the first C function exported from a dll starts with underscore and any subsequesnt name does not. Regards, Martin Disclaimer: I have already posted this as a subquestion in one D-Learn thread, but it did not get much attention... Do you mean exported by dmd? AFAIK on Windows cdecl function names are prefixed with an underscore.
Re: Names of C functions exported from a dll
I think this is a linker bug: http://d.puremagic.com/issues/show_bug.cgi?id=3956 A workaround is to list the names in the linker definition file. On 02.01.2012 14:06, Martin Drasar wrote: Hi everybody, I wanted to ask if there is any specific reason why the name of the first C function exported from a dll starts with underscore and any subsequesnt name does not. Regards, Martin Disclaimer: I have already posted this as a subquestion in one D-Learn thread, but it did not get much attention...
Re: Names of C functions exported from a dll
Dne 2.1.2012 19:52, Martin Nowak napsal(a): Do you mean exported by dmd? AFAIK on Windows cdecl function names are prefixed with an underscore. Yes, dmd v2.057 This code: import std.c.windows.windows; import core.sys.windows.dll; export extern (C) void fn1() {} export extern (C) void fn2() {} export extern (C) void fn3() {} extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) { return true; } gives this output in dependency walker: _fn1 fn2 fn3 whereas this C++ code: extern "C" _declspec(dllexport) int _cdecl fn1() { return 1; } extern "C" _declspec(dllexport) int _cdecl fn2() { return 1; } extern "C" _declspec(dllexport) int _cdecl fn3() { return 1; } compiled with VS2008 gives this output in dependency walker: fn1 fn2 fn3 so I guess that cdecl does not necessary mean underscore in function name... Martin
Re: Names of C functions exported from a dll
Dne 2.1.2012 20:02, Rainer Schuetze napsal(a): I think this is a linker bug: http://d.puremagic.com/issues/show_bug.cgi?id=3956 A workaround is to list the names in the linker definition file. Hi, thanks for the answer. It really looks like that bug... Am I the only one who regularly has mail threads torn into several separate threads? (which does real wonders for keeping the list readable) Martin
Re: Names of C functions exported from a dll
On Monday, 2 January 2012 at 21:39:42 UTC, Martin Drašar wrote: Am I the only one who regularly has mail threads torn into several separate threads? (which does real wonders for keeping the list readable) No. Most of it is due to a problem with the mailing list gateway. Its maintainer doesn't seem to want to acknowledge it or something.