I am trying to use shared libraries in Linux. I use dlopen to load a .so file, and it worked if I set LD_LIBRARY_PATH before running my program. However, I want to set the LD_LIBRARY_PATH using setenv during runtime, instead of setting it before running the probram. I use setenv to set the LD_LIBRARY_PATH, but that does not work, and dlopen returns an error that it cannot find the libXXXX.so file. Could anyone give me some hints to set the path to find shared library files during runtime?