How to create shared library on linux?
Li Jie
cpunion at gmail.com
Tue Aug 15 12:37:37 PDT 2006
> 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
More information about the Digitalmars-d-learn
mailing list