runtime loading D shared library as a standalone (with it's own GC etc)

Timothee Cour thelastmammoth at gmail.com
Wed Feb 26 23:19:12 PST 2014


On Wed, Feb 26, 2014 at 1:20 PM, Adam D. Ruppe <destructionator at gmail.com>wrote:

> Try compiling your library with -defaultlib= (leaving it blank after the
> equal sign). Then it might work by not loading the symbols for phobos etc
> twice - they will only be linked into the main program.
>

Thanks, but I don't see how that would help treating the D dll as a
standalone library with its own GC/druntime etc. Once again, I'm doing
runtime loading (via dlopen+friends) not load-time linking (via -L-lfoo
compile flags).

Furthermore, the following:
dmd -oflibfoo.dylib -shared -defaultlib= foo.d
results in link errors (because of '-defaultlib= ')

and I also tried:
dmd -offoo.o -c foo.d
gcc foo.o -shared -o libfoo.dylib -Wl,-flat_namespace -Wl,-undefined
-Wl,suppress

followed by runtime loading it in a D program (via dlopen) but not
surprisingly this crashes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140226/3f03a1ea/attachment-0001.html>


More information about the Digitalmars-d-learn mailing list