DLL with same conventions as VC++

Gilles G. schaouette at free.fr
Thu Jun 21 01:37:33 PDT 2007


I enventually managed to make it work...
It appeared that the problem wasn't the dll export convention.
I discarded some of the function I exported and now the dll is well recognised by the main app.

Just to be exhaustive:
To have a VC++ compatible dll interface, one just need to put
extern(Windows) in front of the function declaration instead of __stdcall in the function declaration.
You also have to use a .def file were the names of the functions you want to export are listed like:
EXPORTS
    MyFunction1
    MyFunction2
Use the DllMain function (copy/paste) given here:
http://www.digitalmars.com/d/dll.html

Thanks a lot for your help!

--
Gilles

torhu Wrote:

> By the way, if you're trying to call C++ code from D, it has to be 
> extern "C" functions.  C++ symbols are mangled differently than D or C 
> symbols.




More information about the Digitalmars-d mailing list