www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Re: How to create shared library on linux?

 DMD can not create shared libraries on linux yet, but GDC can.

Thanks. I try to use gdc, but I get some errors. /*** CODE ***/ test.d: extern(C){ export void test(){} } so.c: static void _init(void) __attribute__((constructor)); static void _fini(void) __attribute__((destructor)); void gc_init(); void gc_term(); void _minit(); void _moduleCtor(); void _moduleUnitTests(); void _init(void){ gc_init(); _minit(); _moduleCtor(); _moduleUnitTests(); } void _fini(void){ gc_term(); } /*** CODE END ***/ Compile: gcc -c so.c gdc -oTest.so so.o test.d -fPIC -shared It passed. But when load it, some errors happend: undefined symbol: _minit
Aug 15 2006