When all completed, we should make an article on the website out of this.

Andrei

On 3/25/13 3:46 PM, Walter Bright wrote:
If you're making a D shared library, you'll need to use a shared library
version of druntime for both the executable and your shared library.
Otherwise, there will be two instances of druntime, and There Can Be
Only One.

I have 3 pull requests in to do this:

https://github.com/D-Programming-Language/druntime/pull/462
https://github.com/D-Programming-Language/phobos/pull/1223
https://github.com/D-Programming-Language/dmd/pull/1798

What these do is:

1. build druntime as a shared library, need -defaultlib= to do that

2. split libdruntime.a off from libphobos2.a, so now the following flags
must be passed to the link step:

-lphobos2 -ldruntime

3. add the ability to link to the shared library version of druntime
instead, with -shared-druntime flag to dmd:

-lphobos2 -ldruntimeso

I couldn't find a linker flag to prefer libdruntime.so over
libdruntime.a, or vice versa, so I named the shared library
libdruntimeso.so. Ugh. If there's a better way, please let me know.

This is currently linux only, until we get things ironed out.

If you want to try out the shared druntime, you'll need to set
LD_LIBRARY_PATH. I set mine to:

LD_LIBRARY_PATH=/home/walter/cbx/mars/phobos/generated/linux/64:/home/walter/cbx/mars/phobos/generated/linux/32

_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to