[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unloading dynamic libraries
From: |
John Max Skaller |
Subject: |
Re: unloading dynamic libraries |
Date: |
Thu, 14 Oct 2004 10:53:33 +1000 |
User-agent: |
Pan/0.13.3 (That cat's something I can't explain) |
On Mon, 11 Oct 2004 20:48:45 -0700, Paul Pluzhnikov wrote:
> "John Max Skaller" <skaller@nospam.com.au> writes:
>
>> Here is how they're linked:
>>
>> g++ -w -Wl,-shared -Wl,--export-dynamic \
>> -o rtl/libflx_dynamic.so rtl/flx_gc_dynamic.o
>
> This is incorrect. Use this instead:
>
> g++ -w -shared
> -o rtl/libflx_dynamic.so rtl/flx_gc_dynamic.o
>
> --export-dynamic is only meaningful for *executables*,
OK, thanks!
>you should not "hide" -shared from g++.
Hmm. There's a reason for syntax I used, related to
the fact that Solaris ld isn't the same as gnu ld.
I had problems on Solaris mainly due to the fact
gcc was compiled with gnu ld hard coded, but the Solaris
version of ld was the native one. So I couldn't call ld
directly (i'd get the wrong one and no way to tell).
So the line above attempts to bypass gcc completely:
its a pure link step, I'm calling gcc just so I can
call the correct linker.
> To see what difference this makes, run 'g++ -v -shared ...' and
> 'g++ -v -Wl,-shared ...' and compare the results.
I'll do that!
>> Here is how the mainline is built:
>>
>> g++ -w -Wl,-Bdynamic -Wl,--export-dynamic -ldl -o bin/flx_run \
>> -Lrtl -lflx_dynamic rtl/flx_run_dynamic.o
>
> Linking libraries before objects is bad style(TM).
> *Always* link libraries *after* objects (it doesn't much matter
> for shared libraries, but it matters a lot for archive libraries).
OK, I'll fix that. I'm not an expert on the weirdness of gcc,
elf style dynamic linkage ..
>> The relevant code is part of the Felix project:
>> http://felix.sf.net
>
> I am appalled: why in the world can't they use *reasonable* link
> commands? Don't they know any better?
I'm the author. I don't know any better -- that's why I'm
asking here :)