问题
I writed a dynamic library that loaded into some target applications by setting environment variable named DYLD_INSERT_LIBRARIES, the dylib load and works fine when application executed from terminal by this commands:
$ export DYLD_INSERT_LIBRARIES=/path/to/mylib.dylib
$ /path/to/application.app/Contents/MacOS/executable
Then I set the value of DYLD_INSERT_LIBRARIES by editing LSEnvironment section in info.plist file. Some apple standard applications such as TextEdit and Calculator load my library successfuly but this settings take no effect over applications such as InDesign , Photoshop , ...
Why envronment variables do not set for some applications? Does anyone have an idea about it? Thankyou.
回答1:
As you did not further specify, I assume you launch Photoshop and the like via terminal too (?) Which renders these environment variables set in LSEnvironment ineffective as these are only used by processes started via "Launch Services"...
If you start it via "Launch Services", did you check that your library is not simply unloaded via dlclose() by the program?...
来源:https://stackoverflow.com/questions/10535085/lsenvironment-section-of-info-plist-take-no-effects