LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-27-2009, 02:02 AM   #1
zb10948
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Rep: Reputation: 0
static and dynamic linking


Hello,

is it possible, with GNU toolchain, to statically relink dynamically linked binary? For instance, if i have a.out that depends on libsomething, i want to integrate libsomething into a.out.
 
Old 04-27-2009, 03:48 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Yes, but you will need:
  • the source code for the program (to be precise: actually the object file).
  • The static version of the lib. If you have the source, you can probably recompile the lib to static version (*.a type of lib file instead of *.so).
  • Relink the object file of the program with the static lib

But, are you sure you need to do this? If there is an update for the (shared version) of the lib, your program will still use the old version until it gets re-linked with the new version of the static lib. Also using static libs isless memory efficient.
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc errors on static, but NOT dynamic, linking MALDATA Programming 5 10-02-2008 11:20 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
Linking a static library to a dynamic one delta4s Programming 2 09-28-2006 01:24 AM
dynamic linking joshknape Linux - Software 1 09-19-2005 09:43 PM
Static/dynamic linking ugenn Linux - Software 0 12-15-2002 11:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration