I was using the SDL2 library I installed with homebrew. I was just wondering if the libraries I linked were statistic or dynamic and how to tell with these package managers.
CodePudding user response:
Homebrew installs both libraries for dynamic and static linkage. It installs also the useful utility sdl2-config
. Run
sdl2-config --cflags --static-libs
- --cflags Print the compiler flags that are necessary to compile a program or library that uses SDL.
- --static-libs Print the linker flags that are necessary to statically link a program that uses SDL.
If you have not linked SDL like --static-libs
showed, you have linked the shared SDL library.
FYI A library can not be dynamic, it is either a shared or a static library, for either dynamic (at runtime) or static (at compile time) link respectively.