"-L", tells the compiler where the library(ies) can be found for compilation
"-l", tells the compiler the name of the library(ies)
It doesn't tell the executable where the libraries are (since the location can change from one system to another)
Then comes a difference:
- Static library: from a ".o", makes the created executable to be independent of the library (and doesn't require the lib to be distributed with it).
- Dynamic library: from a ".so", makes the created executable dependent on a library that the user needs to provide to the executable though the environment variable "LD_LIBRARY_PATH", which holds the path to where local dynamic libraries are found. By default thte path doesnt contain "the current directory", hence we need to re-export it.
In our case we use a dynamic library we provided. In many cases dynamic libraries are prefered.