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
- Host: GitHub
- URL: https://github.com/perrette/compile_tests
- Owner: perrette
- Created: 2016-02-06T11:59:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-06T12:23:41.000Z (over 10 years ago)
- Last Synced: 2025-10-15T16:29:12.511Z (8 months ago)
- Language: Makefile
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 !
```