D Linking library behaviour

Maxim Fomin maxim at maxim-fomin.ru
Fri Nov 9 02:41:27 PST 2012


On Friday, 9 November 2012 at 09:08:29 UTC, bioinfornatics wrote:
> On Friday, 9 November 2012 at 08:28:40 UTC, Maxim Fomin wrote:
>> On Friday, 9 November 2012 at 08:22:53 UTC, bioinfornatics 
>> wrote:
>>> Hi,
>>> ...
>>
>> You should create an object file and then make a shared 
>> library from it.
>
>  the problem is not how to create a library the command given 
> below works fine. If i use generate object file with model FPIC 
> and after create the lib from these file the problem is same. 
> the generated library has some unused link.
> Could you do the try with both gdc/ldc to know if that is same?

If I understood right, the problem is in extra linkage. Using 
your libFoo.d:
# dmd libFoo.d -c -fPIC
# gcc libFoo.o --shared -o libFoo.so.1
# ldd libFoo.so.1
	linux-vdso.so.1 (0x00007fff87307000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f57b7f50000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f57b8517000)

I have no gdc/ldc so I cannot tell which options should you use, 
but I believe it is possible by using similar method: generating 
object file and manually creating library from that file.


More information about the Digitalmars-d mailing list