Mac OSX中的@executable_path, @load_path和@rpath的理解

原文出处:【24K纯开源

Note: this article is actually about the @executable_path@load_path and @rpath install paths used by the linker on Mac OS X; wiki titles can't include underscores, however, because they are ambiguous with spaces.

Absolute paths

Useful for frameworks installed in shared locations. Example:

  • Install path: /Library/Frameworks/Foo.framework/Versions/A/Foo

@executable_path

Useful for frameworks embedded inside applications, because it allows you to specify the location of the framework relative to the application's executable:

  • Install path: @executable_path/../Frameworks/Foo.framework/Versions/A/Foo
  • Application location: /Applications/Foo.app
  • Executable path: /Applications/Foo.app/Contents/MacOS
  • Framework location: /Applications/Foo.app/Contents/Frameworks/Foo.framework
  • Linker puts all this together to figure out that the framework binary can be found at:/Applications/Foo.app/Contents/MacOS/../Frameworks/Foo.framework/Versions/A/Foo

@loader_path

Available from Mac OS X 10.4 Tiger onwards; useful for frameworks embedded inside plug-ins, because it allows you to specify the location of the framework relative to the plug-in's code (remember, plug-ins may not actually know where they are going to be installed, relative to the application, so knowing @executable_path doesn't help us in this case):

  • Install path: @loader_path/../Frameworks/Foo.framework/Versions/A/Foo
  • Application location: /Applications/Foo.app
  • Plug-in location: /Library/Application Support/Foo/Plug-Ins/Bar.bundle
  • Executable path: /Applications/Foo.app/Contents/MacOS
  • Loader path: /Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/MacOS
  • Framework location: /Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/Frameworks/Foo.framework
  • Linker puts all this together to figure out that the framework binary can be found at: /Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/MacOS/../Frameworks/Foo.framework/Versions/A/Foo

Note that if the "loader" is an application rather than a plug-in, the @loader_path ends up being equivalent to@executable_path.

@rpath

New in Mac OS X 10.5 Leopard is @rpath. Key points:

  • @rpath instructs the dynamic linker to search a list of paths in order to locate the framework
  • critically, this list is embedded in the loading application
  • this means that a single framework with @rpath/Foo.framework/Versions/A/Foo can be made to work in a number of different ways; that is, you are effectively no longer limited by the choice of specifying your "install path" using either@executable_path or @loader_path
  • the down side: you now have to pass additional linker flags when building the host application (eg. -rpath @executable_path/../Frameworks or /Library/Frameworks; note that specifying both will cause the dynamic linker to try looking in both locations)

Sources

Mac OSX中的@executable_path, @load_path和@rpath的理解(网摘)的更多相关文章

  1. Mac OSX中的@executable_path, @load_path和@rpath的理解

    本文转载自:https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath.个人觉得写的很不错,简洁明了. Absolute path ...

  2. [图文详解] Sublime Text在Windows/Ubuntu/Mac OSX中配置使用CTags

    很开发者都在找Sublime Text中函数转跳的功能,这个是软件自身没有的功能,要靠CTags这个插件配合CTags的可执行程序的实现的.按照我的理解是CTags扫描索引你的项目文件,然后subli ...

  3. Sublime Text2/3怎样在Mac OSX中配置CTags插件

    参考地址: http://jingyan.baidu.com/article/48206aeafba820216ad6b3f5.html

  4. mac osx 上面部署Django项目 apache+mysql+mod_wsgi

    1.安装Xcode command line tools 首先,编译mysql和Homebrew需要用到Xcode command line tools,所以首先安装command line tool ...

  5. 在Mac OSX上运行Windows应用程序

    在Mac OSX中,借助wine,不需要安装虚拟机也可以运行Window应用程序. wine是一个在Linux和UNIX之上的,WIndows3.x和Windows APIs的实现.是运用API转换技 ...

  6. XE6移动开发环境搭建之IOS篇(8):在Mac OSX 10.8中安装XE6的PAServer(有图有真相)

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 安装PAServer ...

  7. XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装Xcode4.6.3(有图有真相)

    网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 在安装Xcode前, ...

  8. Mac OSX 下用 Homebrew 安装 MongoDB 并配置到 WebStorm 中

    1. 安装 Ruby OSX 操作系统内置 Ruby,但如果没有 Ruby,则需先输入以下命令安装能够进行多版本ruby环境安装.管理和切换的命令行工具 RVM. 1.1 安装 RVM 打开终端输入以 ...

  9. XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装XE6的PAServer(有图有真相)

    XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装XE6的PAServer(有图有真相) 2014-08-22 21:06 网上能找到的关于Delphi XE系列的移动开发环境的 ...

随机推荐

  1. office 2013幻灯片中插入SmartArt图形时出现错误下列一个或多个文件由于包含错误而无法运行

    office 2013幻灯片中插入SmartArt图形时出现错误下列一个或多个文件由于包含错误而无法运行 系统:win8 64位 PowerPoint2013 64位 在幻灯片中插入SmartArt图 ...

  2. TCP 连接重置漏洞 - CVE-2004-0230讲解

    TCP 连接重置漏洞 - CVE-2004-0230: IPv6 实施中存在一个拒绝服务漏洞,该漏洞可能允许攻击者向受影响系统发送特制的 TCP 消息. 成功利用此漏洞的攻击者可能会导致受影响系统重置 ...

  3. Vuejs——v-on

    版权声明:出处http://blog.csdn.net/qq20004604   目录(?)[+]   资料来于官方文档: http://cn.vuejs.org/guide/events.html ...

  4. Struts2+Spring+Hibernate+Jbpm技术实现Oa(Office Automation)办公系统第一天框架搭建

    =============编码规范,所有文健,所有页面,所有数据库的数据表都采用UTF-8编码格式,避免乱码:===========开发环境:jdk1.7+tomcat8.0+mysql5.7+ecl ...

  5. centos7安装nodejs

    方法一.https://github.com/nodesource/distributions#rpminstall 按照上面地址中的教程安装完后,使用node -v命令报错: -bash: /usr ...

  6. Aspose.words 书签定位

    1. 简介 Aspose.words 可以在不使用 Microsoft.Word 的情况下生成.修改.转换.打印文档.不依赖office组件,这一点给我们提供了极大的便利性,可以简单的引入 DLL(D ...

  7. LoadRunner接口工作总结

    因为工作中需要开发维护类似枢纽性质的平台,所以经常利用LR进行接口测试.接口自动化测试.接口压力测试.用多了LR,有点不愿意使用报文编辑器进行手工接口测试了.  接口脚本操作过程: 首先:打开LR,N ...

  8. .net 自动摘要等算法 HanLP.net

    参考资料: http://www.hankcs.com/nlp/call-hanlp-in-csharp.html 目前自动摘要算法似乎没有.net 版本,而以java,python 居多 自动摘要算 ...

  9. tensorflow max_pool(最大池化)应用

    1.最大池化 max pooling是CNN当中的最大值池化操作,其实用法和卷积很类似. tf.nn.max_pool(value, ksize, strides, padding, name=Non ...

  10. 机器学习(4)Hoeffding Inequality--界定概率边界

    问题 假设空间的样本复杂度(sample complexity):随着问题规模的增长导致所需训练样本的增长称为sample complexity. 实际情况中,最有可能限制学习器成功的因素是训练数据的 ...