Linking C libraries with DMD

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 21 13:55:10 PST 2016


On Thursday, 21 January 2016 at 21:39:08 UTC, Dibyendu Majumdar 
wrote:
>
> Hi I am also new to D and trying to do similar things - i.e. 
> call a shared library written in C from D, but also create a 
> shared library in D.
>
> For the latter - on Windows 10 b64-bit - I am using following 
> options for example:
>
> -shared -L/LIBPATH:c:\\lib  -L//IMPLIB:mylib.lib
>
> In my case I would like stuff from my D code to be exported. I 
> found that I need to do following if I want to export a C API.
>
> extern (C) export void myfunc();
>
> I did not find examples of how to export D classes / functions 
> - and right now I am getting link errors when trying to export 
> D code.
>
> Regards
> Dibyendu

I'm not having any luck using your options with dmd either 
(excluding -shared because I don't need to create a shared D 
library).


More information about the Digitalmars-d-learn mailing list