Thread: RE: [Dev-C++] Linker :: Under the hood.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Damien A <g_...@ho...> - 2004-05-27 16:01:41
|
<html><div style='background-color:'><DIV class=RTE> <P><BR>"ld (and therefore gcc) is sensitive about the order in which libraries and object<BR>files are specied on the command line. If libfoo.so depends on libbar.so, you<BR>must specify libfoo.so first (as counterintuitive as this may be). The reason is<BR>that ld keeps track only of unresolved symbols as it links. If libfoo.so and<BR>libbar.so depend on each other, one of the libraries will have to be specified<BR>twice (for example, -lfoo -lbar -lfoo)." -Programming Linux Games , pg 33<BR></P></DIV> <DIV></DIV>----Original Message Follows---- <DIV></DIV>From: Siva Chandra <siv...@ya...> <DIV></DIV>To: dev...@li... <DIV></DIV>Subject: [Dev-C++] Linker :: Under the hood. <DIV></DIV>Date: Thu, 27 May 2004 08:47:17 -0700 (PDT) <DIV></DIV> <P>MIME-Version: 1.0 </P> <P> </P> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>Hello all, <DIV></DIV> <DIV></DIV>I am trying to understand how the linker goes about <DIV></DIV>doing its work. Say I have two linker options -lx and <DIV></DIV>-ly. If I pass them in the order -lx -ly the linker <DIV></DIV>seems to be doing its job fine. But if I pass -ly -lx <DIV></DIV>the linker spits hell a lot of undefined references at <DIV></DIV>me!! Can someone throw light on how the linker goes <DIV></DIV>about doing its work under the hood. Specifically, <DIV></DIV>what has the order got to do with it? <DIV></DIV> <DIV></DIV>Siva Chandra <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>__________________________________ <DIV></DIV>Do you Yahoo!? <DIV></DIV>Friends. Fun. Try the all-new Yahoo! Messenger. <DIV></DIV>http://messenger.yahoo.com/ <DIV></DIV> <DIV></DIV> <DIV></DIV>------------------------------------------------------- <DIV></DIV>This SF.Net email is sponsored by: Oracle 10g <DIV></DIV>Get certified on the hottest thing ever to hit the market... Oracle 10g. <DIV></DIV>Take an Oracle 10g class now, and we'll give you the exam FREE. <DIV></DIV>http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click <DIV></DIV>_______________________________________________ <DIV></DIV>Dev-cpp-users mailing list <DIV></DIV>Dev...@li... <DIV></DIV>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm <DIV></DIV>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users <DIV></DIV></div><br clear=all><hr>STOP MORE SPAM with <a href="http://g.msn.com/8HMAEN/2728??PS=47575">the new MSN 8</a> and get 2 months FREE*</html> |
|
From: <wa...@wa...> - 2004-05-27 16:41:00
|
On 27 May 2004 at 8:47, Siva Chandra wrote: > > Hello all, > > I am trying to understand how the linker goes about > doing its work. Say I have two linker options -lx and > -ly. If I pass them in the order -lx -ly the linker > seems to be doing its job fine. But if I pass -ly -lx > the linker spits hell a lot of undefined references at > me!! Can someone throw light on how the linker goes > about doing its work under the hood. Specifically, > what has the order got to do with it? The order shouldn't have anything to do with it. Watson |
|
From: <wa...@wa...> - 2004-05-27 16:58:19
|
On 27 May 2004 at 12:00, Damien A wrote: > > "ld (and therefore gcc) is sensitive about the order in which > libraries and object > files are specied on the command line. If libfoo.so depends on > libbar.so, you > must specify libfoo.so first (as counterintuitive as this may be). The > reason is that ld keeps track only of unresolved symbols as it links. > If libfoo.so and libbar.so depend on each other, one of the libraries > will have to be specified twice (for example, -lfoo -lbar -lfoo)." > -Programming Linux Games , pg 33 Wow. Interesting. Thanks! Watson |
|
From: Siva C. <siv...@ya...> - 2004-05-28 08:37:21
|
Hello all, That was insightfull but also lead to another question. How do inline functions get linked? Siva Chandra --- Damien A <g_...@ho...> wrote: --------------------------------- "ld (and therefore gcc) is sensitive about the order in which libraries and object files are specied on the command line. If libfoo.so depends on libbar.so, you must specify libfoo.so first (as counterintuitive as this may be). The reason is that ld keeps track only of unresolved symbols as it links. If libfoo.so and libbar.so depend on each other, one of the libraries will have to be specified twice (for example, -lfoo -lbar -lfoo)." -Programming Linux Games , pg 33 __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ |
|
From: Per W. <pw...@ia...> - 2004-05-28 09:00:04
|
When they are inlined, they are not linked. The compiler throws in suitable assembler instructions directly. When the inline function isn't inlined - because it is too large etc - normally all source files that saw the inline declaration will get a "common" code block with the function code. The function then works as any other function with the extra feature that the linker doesn't complain if multiple object files specifies the function. The linker just selects one instance of the function and throws away the other instances. /Per W On Fri, 28 May 2004, Siva Chandra wrote: > > Hello all, > > That was insightfull but also lead to another > question. > How do inline functions get linked? > > Siva Chandra > > --- Damien A <g_...@ho...> wrote: > > --------------------------------- > > > "ld (and therefore gcc) is sensitive about the order > in which libraries and object > files are specied on the command line. If libfoo.so > depends on libbar.so, you > must specify libfoo.so first (as counterintuitive as > this may be). The reason is > that ld keeps track only of unresolved symbols as it > links. If libfoo.so and > libbar.so depend on each other, one of the libraries > will have to be specified > twice (for example, -lfoo -lbar -lfoo)." -Programming > Linux Games , pg 33 > > > > > > __________________________________ > Do you Yahoo!? > Friends. Fun. Try the all-new Yahoo! Messenger. > http://messenger.yahoo.com/ > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |