LSEnvironment section of info.plist take no effects.
Asked Answered
C

1

4

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.

Coraliecoraline answered 10/5, 2012 at 13:31 Comment(4)
Did you find any explanation for this? I am also struggling with it.Reluct
No, I didnt find any explanation for it. I now use a proxy executable to inject my lib to apps.Coraliecoraline
Does this work when you need to inject your lib when the process starts? Could you give me a link where I can find out more?Reluct
No, It is probably impossible to inject lib after process start in OSX, I copy my proxy exe into bundle dir (./Content/MacOS/) and rename main exe to for example InDesign_org and rename proxy to InDesign, Now when a user exec InDesign from finder, my proxy will be executed and it set the env variable DYLD_INSERT_LIBRARIES and then executes InDesign_org.Coraliecoraline
E
0

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?...

Endue answered 14/7, 2012 at 20:28 Comment(2)
I start it from Finder. "did you check that your library is not simply unloaded via dlclose() by the program?" : my library never loads.Coraliecoraline
I also have trouble with this. Anyone found a solution?Reluct

© 2022 - 2024 — McMap. All rights reserved.