[QBS] Export object files instead of static library
Andrey Anpilogov
anpilog at gmail.com
Mon Jan 12 11:47:45 CET 2015
> "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.
2015-01-12 18:42 GMT+08:00 Joerg Bornemann <joerg.bornemann at theqtcompany.com
>:
> On 12-Jan-15 04:44, Andrey Anpilogov wrote:
>
> One of the things I have no idea how to do is "weak" function in static
>> library.
>> I have one static library that builds as Product. It has couple files
>> with "weak" functions:
>> files:
>> - somelib.cpp
>> - extracool.cpp
>> - base.c
>> - weakfuncs.c
>>
>> Let's say base.c and wealfuncs.c have "weak" functions.
>> Which means I have to link the application:
>> main.cpp.o path_to_lib/somelib.a path_to_lib/base.c.o
>> path_to_lib/weakfuncs.c.o
>>
>
> I'm not sure that I understand your case.
> Why do you have to pass the object files to the linker?
> If you're talking about weak symbols in ELF object files then those
> symbols are marked as "weak" but still exist in a static library, right?
>
>
> BR,
>
> Joerg
>
--
--
WBR,
Andrii Anpilogov
Phone: +86 186-1660-3720
Skype: anpilogov.andrey
mailto:anpilog at gmail.com, andrii.anpilogov at mesheven.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150112/5e19f6e4/attachment.html>
More information about the Qbs
mailing list