In linux how can I tell if I'm linking to a static or dynamic library? In linux how can I tell if I'm linking to a static or dynamic library? linux linux

In linux how can I tell if I'm linking to a static or dynamic library?


You can try running ldd on the executable and seeing if the accompanying .so is being detected as required in the list of dependencies.

ldd man page is here.


If you use the -static flag, all components will be made static. And -l may include shared libraries. So specifying the static library filename (e.g. with /usr/lib/libfoo.a for example, no -l prepended), should get you the desired effect.