3 msgCan I force gcc not to optimize calling to leaf...
2 msgV_MUST_DEF vs V_MAY_DEF ?
12 msgSignedness of char and puts()
6 msgcompile with no prefix
3 msgnewbie trying to install and build
5 msgambiguous std::fill with character array
4 msgC++ Macros, ##, and ::
3 msgnewbie question on linking classes
2 msgBuild Failure for gcc 4.3.0
3 msgDoes GCC really recognize __attribute__ ((bitwi...
2 msgstatic stack check
16 msgProblem with exceptions on arm
1 msgThe Latest
13 msgIssue on X86_64?
1 msgcross compiling on different hosts

Problem with static library linking
\ Harish (24 Mar 2008)
. \ Eljay Love-Jensen (24 Mar 2008)

6 msg[help] undefined reference to `_Unwind_SjLj_Reg...
2 msgGSoC - GCC Multithreaded linker
7 msggcc for windows
2 msgHow does GCC4 transform GIMPLE IR to SSA?
Subject:Re: Problem with static library linking
Group:Gcc-help
From:Eljay Love-Jensen
Date:24 Mar 2008


Hi Harish,

> In my link line libpcap.a comes before mylib.a

Since mylib.a depends on libpcap.a, mylib.a should come before libpcap.a on
your link line.

Otherwise, unfulfilled symbols in mylib.a won't be found because libpcap.a
had already been processed.

Order of archives on the link line is significant.

If you have circular dependencies in your archive libraries (ugh! Avoid if
possible!), you can do:

gcc -o myapp \
foo.c \
alpha.a \
beta.a \
alpha.a

...or on many platforms that use GNU ld...:

gcc -o myapp \
foo.c \
--Wl,--whole-archive \
alpha.a beta.a \
--Wl,--no-whole-archive

HTH,
--Eljay



© 2004-2008 readlist.com