Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Dynamic linking
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
deepak  
View profile  
 More options Nov 5, 12:23 am
Newsgroups: comp.os.linux.development.system
From: deepak <deepakpj...@gmail.com>
Date: Wed, 4 Nov 2009 05:23:10 -0800 (PST)
Local: Thurs, Nov 5 2009 12:23 am
Subject: Dynamic linking
Hi,

If the shared library for printf is missing on my linux machine,
I'm expecting an error at the time of loading instead of happening
it while linking. Is this a correct assumption?

If thats the case, how we are getting linker error for a typo error
for printf and loader error for missed library? My assumption
is because the prototype for printf can be visible while linking
and with a hope of resolving it while loading they are continuing with
linking.

Please correct my understanding if it's wrong.

Thanks,
Deepak


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schwartz  
View profile  
 More options Nov 5, 1:45 am
Newsgroups: comp.os.linux.development.system
From: David Schwartz <dav...@webmaster.com>
Date: Wed, 4 Nov 2009 06:45:20 -0800 (PST)
Local: Thurs, Nov 5 2009 1:45 am
Subject: Re: Dynamic linking
On Nov 4, 5:23 am, deepak <deepakpj...@gmail.com> wrote:

> If the shared library for printf is missing on my linux machine,
> I'm expecting an error at the time of loading instead of happening
> it while linking. Is this a correct assumption?

It depends what you mean by "while linking". With shared libraries,
linking takes place both right after compiling and right after
loading. The first linking takes place to produce the executable, the
second to attach the shared libraries to it at run time.

> If thats the case, how we are getting linker error for a typo error
> for printf and loader error for missed library? My assumption
> is because the prototype for printf can be visible while linking
> and with a hope of resolving it while loading they are continuing with
> linking.

You need more than a prototype to attach to a symbol in a shared
library. Among other things, you have to know which shared library to
look in.

> Please correct my understanding if it's wrong.

Dynamic linking, at compile and executable production time, works just
like static linking. Except instead of statically linking to the
underlying function, you statically link to a stub. At run time, the
stub is hooked into the shared library. If you misspell printf, you
will fail at local link time because there is no stub to statically
link to. If the library is missing, you will fail at run time because
the stub will not have anything to dynamically link to.

DS


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jan Engelhardt  
View profile  
 More options Nov 4, 4:37 pm
Newsgroups: comp.os.linux.development.system
From: Jan Engelhardt <jeng...@linux01.gwdg.de>
Date: Wed, 4 Nov 2009 06:37:07 +0100
Local: Wed, Nov 4 2009 4:37 pm
Subject: Re: Dynamic linking

On Nov 4 2009 06:45, David Schwartz wrote:

>> If the shared library for printf is missing on my linux machine,
>> I'm expecting an error at the time of loading instead of happening
>> it while linking. Is this a correct assumption?

> Dynamic linking, at compile and executable production time, works just
> like static linking. Except instead of statically linking to the
> underlying function, you statically link to a stub. At run time, the
> stub is hooked into the shared library. If you misspell printf, you
> will fail at local link time because there is no stub to statically
> link to. If the library is missing, you will fail at run time because
> the stub will not have anything to dynamically link to.

There is also LD_BIND_NOW that controls the deferred symbol resolution
during execution.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google