www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Linking bug?

reply Satoshi <satoshi gshost.eu> writes:
Hello,

I created mylib.so where I linked libdruntime.a and libphobos.a 
with -L--whole-archive param but mylib.so doesn't contains some 
phobos functions. And program cannot be linked with mylib.so 
(without phobos and druntime). there are some unresolved symbols.
mylib.so doesn't contains some symbols from phobos too. (nm 
mylib.so)

When I added e.g. import std.parallelism; to any file in the 
mylib.so everything works fine.

(druntime is compiled with -d-version=Shared)


Can someone tell me if this is a bug or must I add .a libs to the 
.so in other way?


Im using 1.0.0 LDC for compiling/linking on arch linux with 
custom compiled druntime and phobos.


thanks
Jun 13 2016
parent David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
Hi there,

On 13 Jun 2016, at 11:57, Satoshi via digitalmars-d-ldc wrote:
 Can someone tell me if this is a bug or must I add .a libs to the .so 
 in other way?

 Im using 1.0.0 LDC for compiling/linking on arch linux with custom 
 compiled druntime and phobos.
In general, shared library support is only meant to work with druntime itself being built as a .so instead of linked in as a static library. The symptoms you describe seem a bit bizarre, though. I'd suggest to try building against a proper shared library as intended first to see if they persist. — David
Jun 13 2016