Using D static library from C

Ellery Newcomer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 5 19:13:07 PDT 2014


On Thursday, 5 June 2014 at 18:51:25 UTC, George Sapkin wrote:
> I'm trying to link a simple D static library to C code, but I'm 
> can't figure out how to do it properly without getting a 
> segfault when running it.

try this:

dmd -lib test.d -defaultlib=libphobos2.a -oflibtest.a
gcc main.c libtest.a -l:libphobos2.a -lpthread -lm -lrt


More information about the Digitalmars-d-learn mailing list