[QBS] Export object files instead of static library

Joerg Bornemann joerg.bornemann at theqtcompany.com
Tue Jan 13 14:37:27 CET 2015


On 12-Jan-15 11:47, Andrey Anpilogov wrote:
>  > "those symbols are marked as "weak" but still exist in a static
> library, right?"
> They do. But they will not be linked because of priority.
> So I have program.c with:
> void "weak" foo() {};
>
> and target.c:
> void foo() {do_something();}
>
> If I link them together into static library and link with ELF file then
> "weak" foo() is going to be executed.
>
> The only one way to workaround it is link program.c.o and target.c.o as
> object to ELF file.

So you're defining a weak symbol S1 with name "foo" in your lib.
In your program that uses the lib you define S2, also with name "foo". 
S2 now overrides S1, because S1 is weak and S2 is strong. But you want 
to prevent the override by passing the object file with S1 as last 
argument to the linker.
Do I unstand correctly?


Joerg



More information about the Qbs mailing list