An open API service indexing awesome lists of open source software.

https://github.com/perrette/compile_tests

Test compilations, shared vs static libraries
https://github.com/perrette/compile_tests

Last synced: 4 months ago
JSON representation

Test compilations, shared vs static libraries

Awesome Lists containing this project

README

          

# compile_tests
Test compilations, shared vs static libraries

Conclusion: very similar use of shared and static libraries. Compilation with shared library requires knowledge of `.so` path on runtime, via `-Wl,-rpath,lib` option. Static library is simpler to use.

Examples:

```
# compilation using shared library
make clean shared
rm -f ./obj/mod1.o # object file(s) not nececssary any more ! (the `.mod` file is !)
make main
./bin/main # that works

# try removing the library
rm -rf lib
./bin/main # that fails !

# compilation using static library
make clean static main
./bin/main # that works

# try removing the libray and all compilation objects
rm -rf lib obj include
./bin/main # that still works !
```