LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   static and dynamic libraries (https://www.linuxquestions.org/questions/programming-9/static-and-dynamic-libraries-520512/)

nesta 01-18-2007 09:05 AM

static and dynamic libraries
 
hi folks,
i want to know what is the differences between:
1)cross-compiling and our normal compiling
2)static and dynamic linking
3)static and shared libraries

jim mcnamara 01-18-2007 09:16 AM

Have you searched the forums? These questions have been answered often.

nesta 01-21-2007 04:21 AM

hi all,
i have take your advice and read about static linking and dynamic linking but i still have one question:

can the static library be loaded during the run-time ?
or is it only loaded during the compile time ?

thanks in advance.

The Headacher 01-21-2007 04:37 AM

I'm not sure how this is in other languages, but in C both static and shared libraries can be loaded dynamically.

Here's a "program library Howto" that I am using to get a better understanding of libraries at the moment: http://www.dwheeler.com/program-library/

nesta 01-21-2007 10:25 AM

dear the headacher
can u send the link again , as it does not work?
thanks in advance.

The Headacher 01-21-2007 10:46 AM

Hmm.. It was there earlier today, but it seems down now. It's also hosted here: http://tldp.org/HOWTO/Program-Library-HOWTO/index.html

paulsm4 01-21-2007 11:21 AM

Quote:

can the static library be loaded during the run-time ?
or is it only loaded during the compile time ?
Static libraries (generally ".a" files on *nix, and ".lib" files on DOS/Windows) are included into the exe at link time (not compile time). They become part of the executable code.

Shared libraries, on the other hand, are brought in as-needed into the running process at execution time. This can be done automatically by the OS at program startup, or programmatically by the process itself as it executes.

Cross compiling is completely different - it's running a compiler on one machine (like an x86 running Linux) to compile objects and build executables for a complete different machine (like an embedded system).

The link cited above it a good one:
http://tldp.org/HOWTO/Program-Library-HOWTO/index.html

Here are a couple of others that might help:

http://en.wikipedia.org/wiki/Shared_library
http://yolinux.com/TUTORIALS/Library...ndDynamic.html
http://docs.python.org/ext/dynamic-linking.html

Marko-M 04-09-2011 06:28 PM

If anyone stumbles here, I've wrote three howtos on my site about C/C++ library programming on Linux (creating and using shared and static libraries).

Here are the links:

C/C++ library programming on Linux – Part one: Static libraries

C/C++ library programming on Linux – Part two: Dynamic libraries

C/C++ library programming on Linux – Part three: Dynamic libraries using POSIX API

Good luck!

Sergei Steshenko 04-10-2011 12:34 AM

Quote:

Originally Posted by nesta (Post 2595591)
...
can the static library be loaded during the run-time ?
or is it only loaded during the compile time ?
...

How about first looking up definitions on the web ?

I.e. try to enter

static library

into whatever web search engine and read the matches.

knudfl 04-10-2011 05:46 AM

Sergei Steshenko, post # 9 :

I'd guess post 8 and the five identical posts from @Marko-M has
an advertisement purpose.

Two times text complaining about "blocked advertisement"
( I use Adblock++ ) is actually paying more attention than
the very short "howto".

( The @ nesta post you answered is four years old.)

..

Marko-M 07-25-2011 03:52 AM

Quote:

Originally Posted by knudfl (Post 4319821)
Sergei Steshenko, post # 9 :

I'd guess post 8 and the five identical posts from @Marko-M has
an advertisement purpose.

Two times text complaining about "blocked advertisement"
( I use Adblock++ ) is actually paying more attention than
the very short "howto".

( The @ nesta post you answered is four years old.)

..

Hi! I wasn't posting links to virus or adult content. I gave three links to my articles I've spent days writing with purpose of helping Linux grow. With money I've came up from ads on my site during last few years you wouldn't buy a decent hamburger so If I wanted to make money I would certainly write about some other more spread OS then Linux. We all love Linux but costs money, time and passion to help it spread. Go out there and write some useful Linux articles or open source software, I've done both ;)

crabboy 09-04-2011 08:36 PM

Marko-M, it's clear that your intentions at LQ are solely to promote your own site. You have a total post count of 6 and 5 of which are identical posts to your brief how-to articles. To gain respect around here, I suggest your answer some recent questions, but I'm pretty sure all you care about are the links back to your site.


All times are GMT -5. The time now is 09:28 AM.