It creates a dynamic shared library that can be loaded and unloaded when the program is running, meaning you don't have to compile/link them during the compile/link cycle. Try looking up the functions in the library dlfcn.h - dlopen(), dlclose() and dlsym().
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
Dynamic libraries can be linked to a running process - so the linking is considered dynamic.
Static libraries are linked to a program at compile time and don't change during execution - the linking is fixed so its static.
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
There are a number of differences between static and dynamic (shared) libraries. I'll summarize some of the more important ones:
1. If you alter a static library and wish for your applications that use it to get the new code, you have to relink them. With shared libraries, you just need to restart them.
2. If more than one application uses a shared library, then the code that is loaded into the computer's memory is also shared, so you can potentially use less memory if you have a number of applications running simultaneously that all use the same library or libraries.
3. If you link a static library, only the functions you need are linked into your program. When you link a shared library, when the program runs, the entire contents of the shared library are loaded into memory. This can offset the memory advantage of shared libraries mentioned in #2 above.
4. If you want to distribute the binary version of a program and not have your users plunged into "dll hell", then statically link it. That way (see #1 above), all the required code bits are wired directly into the application.
rubberman
Posting Virtuoso
1,564 posts since Mar 2010
Reputation Points: 277
Solved Threads: 179