dynamic library building and loading

Rob T rob at ucora.com
Thu Sep 27 17:04:11 PDT 2012


On Thursday, 27 September 2012 at 07:54:29 UTC, Johannes Pfau 
wrote:
> Am Thu, 27 Sep 2012 08:26:36 +0200
> schrieb "Daniel Kozak" <kozzi11 at gmail.com>:
>
>> Now I try it, and it is not required to build shared variant 
>> of druntime and phobos, only rebuild it with -fPIC
>> 
>
> In the end you'll probably need a shared druntime & phobos: 
> Let's say
> your main app doesn't use std.datetime and you statically link
> libphobos. Then the linker might strip std.datetime from your
> executable. If your shared library now needs std.datetime it 
> won't
> work.

I'm using C++ main app that dynamically loads shared libs at 
runtime, but I cannot load D shared libs because they cannot be 
linked to the non-fPIC built phobos2/druntime lib. It seems that 
the only way to get things working is to re-build the C++ code so 
that it is linked with non-fPIC phobos2, but this is not 
something I want to be doing.

So if I read this right, I can build phobos/druntime with -fPIC 
from the source code and it will work OK? If so, then why was 
this not done with the latest distrubution package, or is this 
only possible after a certain version number?

--rt


More information about the Digitalmars-d mailing list