info.plist的LSEnvironment部分不起作用。 [英] LSEnvironment section of info.plist take no effects.

查看:375
本文介绍了info.plist的LSEnvironment部分不起作用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个动态库,通过设置名为DYLD_INSERT_LIBRARIES的环境变量,dylib加载并加载到某些目标应用程序,并通过此命令从终端执行应用程序时工作正常:

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

然后我通过编辑info.plist文件中的LSEnvironment部分设置DYLD_INSERT_LIBRARIES的值。
一些苹果标准应用程序,如TextEdit和Calculator成功加载我的库,但这个设置对InDesign,Photoshop等应用程序没有影响...

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.

推荐答案

因为你没有进一步指定,我假设你通过终端启动Photoshop等?)
这使LSEnvironment中设置的这些环境变量无效,因为这些只是通过Launch Services启动的进程使用
...

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

如果你通过启动服务启动它,你检查你的库不是简单地通过dlclose()卸载程序?...

If you start it via "Launch Services", did you check that your library is not simply unloaded via dlclose() by the program?...

这篇关于info.plist的LSEnvironment部分不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆