[NTLUG:Discuss] re-linking????

Steve Baker sjbaker1 at airmail.net
Sat Apr 15 19:21:32 CDT 2000


aal wrote:

> ok
> so re-linking is just another word for recompiling??

No - it isn't - the process of going from source code to executable is
a two-step deal:

1) Compile.  This generally takes each source file and turns it into
   machine code - which is written into a '.o' file.

2) Linking. Almost all programs of any size are made from many (sometimes
   hundreds) of source files.  Since they are compiled individually, you
   end up with a LOT of '.o' files.  When all the '.o' files, and some
   system libraries ('.a' or '.so') are combined into an executable.

   In actual fact, '.so' libraries are not really combined with the
   '.o's - that happens when the program is actually run - but the
   linker does check that when the program is run it'll have all it
   needs in those '.so' files.

Generally though, these two steps are hidden in one 'build' or 'install'
script or 'Makefile' - so it's a lot easier to recompile AND relink a
program by just rerunning the build instructions than it is to figure
out how to run just the linker step by itself.

There is one special case where you might want to just relink the
program - and that is when you have a commercial program without
source code which links to libraries that are licensed under GPL
or LGPL (as most Linux libraries are).  Under those circumstances,
the authors of the commercial application are REQUIRED by the GPL/LGPL
license to provide you with a means to re-link the program against
alternative '.a' libraries.

Most commercial packages find this an onerous requirement and instead
link to '.so' files so that the actual linking happens at run time.

-- 
Steve Baker                  http://web2.airmail.net/sjbaker1
sjbaker1 at airmail.net (home)  http://www.woodsoup.org/~sbaker
sjbaker at hti.com      (work)




More information about the Discuss mailing list