[D-runtime] Time for druntime for Linux64 to default to a shared lib

Johannes Pfau johannespfau at googlemail.com
Thu Mar 14 06:38:11 PDT 2013


Am 13.03.2013 20:25, schrieb Alex Rønne Petersen:
> The way to deal with both libdruntime.so and libdruntime.a existing on
> a system is to explicitly ask for libdruntime.a when desired (note the
> .a). The linker will prefer the shared library when just -ldruntime is
> passed. So no dmd.conf change should be necessary with regards to
> linking; DMD just has to do the right thing depending on whether
> -shared was passed.
>
When you say "explicitly ask for libdruntime.a" you mean by using the 
gcc/ld options "-Wl,-Bstatic////" and "-Wl,-Bdynamic//" right?

I'd say just ship the release with a libdruntime.so and libruntime.a and 
make sure dmd calls gcc like this:

"gcc -Wl,-Bstatic//-ldruntime -lphobos2 -Wl,-Bdynamic -lpthread -lm -lrt"
This way we don't have to worry about passing the correct .a file to 
gcc, it should automatically detect the correct file.

For dynamic linking, just drop the "-Wl,-Bstatic" / "-Wl,-Bdynamic". 
Then add "|-static-libphobos -static-libdruntime|" flags to select 
between static and dynamic linking. Make  "|-static-libdruntime=true, 
||-static-libphobos=true|" the default for one release, then in the next 
release change the defaults to false. Then linking with a static 
libdruntime would be as simple as passing "|-static-libdruntime|" to dmd.
//

-- 
Johannes Pfau

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d-runtime/attachments/20130314/3fc7e11d/attachment.html>


More information about the D-runtime mailing list