Tuesday, March 12, 2013

how to direct GCC to load library at runtime?

gcc normally register path of dependent library at link time and try to search them at system specific location.
But if library is not located at those locations, then it fails to load.
So to force gcc to link at runtime we can use "-bnoipath".

For example :
 gcc -bnoipath -shared test.o -o test.exe -lxyzlib


this will force test.exe to link with xyzlib.dll at runtime.