http://d.puremagic.com/issues/show_bug.cgi?id=10711
Walter Bright <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Walter Bright <[email protected]> 2013-08-08 00:23:21 PDT --- To reproduce: main.c: #include <stdio.h> #include <stdlib.h> #include <dlfcn.h> int main() { printf("+main()\n"); void *lh = dlopen("/home/walter/tmp/libdll.so", RTLD_LAZY); if (!lh) { fprintf(stderr, "dlopen error: %s\n", dlerror()); exit(1); } printf("libdll.so is loaded\n"); int (*fn)() = dlsym(lh, "dll"); char *error = dlerror(); if (error) { fprintf(stderr, "dlsym error: %s\n", error); exit(1); } printf("dll() function is found\n"); (*fn)(); printf("unloading libdll.so\n"); dlclose(lh); printf("-main()\n"); return 0; } dll.d: import core.stdc.stdio; extern (C) int dll() { printf("dll()\n"); return 0; } static this() { printf("libdll.so construction\n"); } static ~this() { printf("libdll.so destruction\n"); } Build: dmd -c dll.d -fPIC dmd -oflibdll.so dll.o -shared -defaultlib=libphobos2.so -L-rpath=/home/walter/cbx/mars/phobos/generated/linux/release/64 gcc -c main.c gcc -rdynamic main.o -o main -ldl ./main Results: +main() dlopen error: /home/walter/cbx/mars/phobos/generated/linux/release/64/libphobos2.so.0.64: undefined symbol: _Dmain -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
