Compilers
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives FAQs Compilers

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old May 15th, 2008, 07:40 PM
JNLSeb
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
What happens when linking and execution?

Let's say I have a shared library (libmyFile1.so) that contains a
function myFunc1 and it is called by a application myApp1.

I build and link the application
cc -o myApp1 myApp1.o -L/usr/source/lib -lmyFile1

Question 1

What does this linking actually do?
Does it copy the location of myFunc1 within the libmyFile1.so?


I know if doesn't copy the actual code from the shared library unless
I am linking statically. This leads me to my next question. Lets say
I make numerous changes to the underlying code within libmyFile1.so,
but no changes to the function name myFunc1 or any changes to the
parameters.

Question 2

Can I not just replace libmyFile1.so with a newly rebuilt one without
having to relink or rebuild the original application? Is there any
scenario where only the underlying code is modified that would require
a rebuild or relink of the application?
[1: ELF linkers just note the names of the symbols to be resolved and
the places in the executable where they're referenced. The actual locations
are resolved at dynamic link time when the executable starts.

2: So long as the interfaces don't change, i.e., number and types of
arguments, you should be able to build a new library and just use it.
If you change the code so that, e.g., an int argument changes to float,
you'll have to rebuild both sides.

See my book for more info. -John]


Reply With Quote
Reply

Viewing: Web Development Archives FAQs Compilers > What happens when linking and execution?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT