Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


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

Rep: Reputation: 0
static and dynamic linking


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, 04:48 AM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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-03-2008 12:20 AM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
Linking a static library to a dynamic one delta4s Programming 2 09-28-2006 02:24 AM
dynamic linking joshknape Linux - Software 1 09-19-2005 10:43 PM
Static/dynamic linking ugenn Linux - Software 0 12-16-2002 12:01 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:06 PM.

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