views:

84

answers:

3

Can you please explain the concept of static, runtime and dynamic libraries with examples?

+1  A: 

http://www.learncpp.com/cpp-tutorial/a1-static-and-dynamic-libraries/
http://en.wikipedia.org/wiki/Runtime_library

Gishu
runtime and dynamic library concept are same?
Renjith G
+1  A: 

Static libraries are libraries that link with other objects during link (build) time - if your objects are executables then this usually results in a larger executable.

Dynamic libraries are linked with objects (i.e. executables) in runtime either when the executable is loaded or later on using a specific funtion call (i.e. LoadLibrary).

Both have advantages and disadvantages due to their being static or dynamic.

Examples for dynamic libraries are DLL's in windows and .so files in linux. Static libraries are usually only available during development or when building from source - for windows the extension are usually .lib and for linux .a.

There is much more to this and you should do further reading for your specific needs.

smichak
+1  A: 

The main difference is this:

Static library binds up to the program while compiling, the functions from the library become part of the program; and runtime library (as its name suggests) connects at the execution time and is not built into executable.

corydalus