Just starting with D (linking with C++)

sivakon sivakon at outlook.com
Sat Oct 28 14:06:03 UTC 2017


On Saturday, 28 October 2017 at 02:20:42 UTC, codephantom wrote:
> On Friday, 27 October 2017 at 17:14:20 UTC, sivakon wrote:
>> I want to use C++ libraries for machine learning and deep 
>> learning. How do I add C++ libraries to my d code.
>
> on FreeBSD, I use:
>
> for C static binding:
> ----------------------
> clang -c sample.c
>
> dmd -L-lc foo.d sample.o
> or
> ldc -L-lc foo.d sample.o
>
>
> for c++ static binding:
> -----------------------
> clang++ -c sample.cpp
>
> dmd -L-lc++ foo.d sample.o
> or
> ldc -L-lc++ foo.d sample.o
>
>
> There is nice article here that was pretty interesting too:
> https://www.gamedev.net/blogs/entry/2254003-binding-d-to-c/

Thanks! That worked like a charm. Now I can use dlang 
confidently. Any tips to make it faster cflags etc.


More information about the Digitalmars-d-learn mailing list