Problems using setenv and then calling dlopen

I use setenv to set DYLD_LIBRARY_PATH, so when I do dlopen () it will have the correct paths to search for my .dylib, but when I do dlopen () it does not seem to look for the paths that I added before DYLD_LIBRARY_PATH.

From what I can collect, my changes to DYLD_LIBRARY_PATH will not take effect until my process is restarted. Is it correct?

Also, if this is correct, is there a way to set DYLD_LIBRARY_PATH and work with my changes without resetting my process.

Oh yes, I am writing this code on MAC OSX.

Thanks in advance.

+5
source share
2

: setenv LD_LIBRARY_PATH, dlopen.

, @exectuable_path, @loader_path @rpath .dylb, .dylibs dlopen.

+2

Mac OS, Linux getenv("LD_LIBRARY_PATH") , . LD_LIBRARY_PATH execve() s, . , Mac OS.

, rec execve (Java ), , , (Firefox ).

Mac OS , Google, , . , Linux .

+4

All Articles