Mac OSX中的@executable_path, @load_path和@rpath的理解
本文转载自:https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath。个人觉得写的很不错,简洁明了。
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
- Nice overview: http://www.mikeash.com/pyblog/friday-qa-2009-11-06-linking-and-install-names.html
- Docs for using PFiddlesoft Frameworks (I've never used these, but the manual itself makes some nice general points about using frameworks): http://pfiddlesoft.com/frameworks/downloads/Assistive_Application_Programming_Guide.pdf
Mac OSX中的@executable_path, @load_path和@rpath的理解的更多相关文章
- Mac OSX中的@executable_path, @load_path和@rpath的理解(网摘)
Mac OSX中的@executable_path, @load_path和@rpath的理解 原文出处:[24K纯开源] Note: this article is actually about t ...
- [图文详解] Sublime Text在Windows/Ubuntu/Mac OSX中配置使用CTags
很开发者都在找Sublime Text中函数转跳的功能,这个是软件自身没有的功能,要靠CTags这个插件配合CTags的可执行程序的实现的.按照我的理解是CTags扫描索引你的项目文件,然后subli ...
- Sublime Text2/3怎样在Mac OSX中配置CTags插件
参考地址: http://jingyan.baidu.com/article/48206aeafba820216ad6b3f5.html
- mac osx 上面部署Django项目 apache+mysql+mod_wsgi
1.安装Xcode command line tools 首先,编译mysql和Homebrew需要用到Xcode command line tools,所以首先安装command line tool ...
- 在Mac OSX上运行Windows应用程序
在Mac OSX中,借助wine,不需要安装虚拟机也可以运行Window应用程序. wine是一个在Linux和UNIX之上的,WIndows3.x和Windows APIs的实现.是运用API转换技 ...
- XE6移动开发环境搭建之IOS篇(8):在Mac OSX 10.8中安装XE6的PAServer(有图有真相)
网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 安装PAServer ...
- XE6移动开发环境搭建之IOS篇(7):在Mac OSX 10.8中安装Xcode4.6.3(有图有真相)
网上能找到的关于Delphi XE系列的移动开发环境的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 在安装Xcode前, ...
- Mac OSX 下用 Homebrew 安装 MongoDB 并配置到 WebStorm 中
1. 安装 Ruby OSX 操作系统内置 Ruby,但如果没有 Ruby,则需先输入以下命令安装能够进行多版本ruby环境安装.管理和切换的命令行工具 RVM. 1.1 安装 RVM 打开终端输入以 ...
- 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系列的移动开发环境的 ...
随机推荐
- 修改sql数据库文件 物理文件名称
-- 允许配置高级选项 EXEC sp_configure 'show advanced options', 1 GO -- 重新配置 RECONFIGURE GO -- 启用xp_cmdshell ...
- java 获取中文字符的首字母
原理: GB2312编码中的中文是按照拼音排序的 注意: 一些生僻的字无法获得正确的首字母,原因是这些字都是后加入的. import java.io.UnsupportedEncodingExcept ...
- SQL Server CheckPoint的几个误区
有关CheckPoint的概念对大多数SQL Server开发或DBA人员都不陌生.但是包括我自己在内,大家对于CheckPoint都或多或少存在某些误区,最近和高文佳同学(感谢高同学的探讨) ...
- UI控件(UIAlertController)
@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; UIButton *_button = [UIBut ...
- LInux MySQL 端口验证
linux suse11在terminal可以正常登录进行各种操作,在tomcat运行jdbc web程序异常: com.mysql.jdbc.exceptions.jdbc4.Communicati ...
- CentOS6编译安装PHP7+Nginx
本文属于动手搭建PHP开发环境的一部分,更多点击链接查看. 本文以centos6为例. 安装PHP 下载 http://cn2.php.net/distributions/php-5.6.22.tar ...
- ESP8266刷AT固件与nodemcu固件
这回是使用的这一款 因为这款默认的是支持AT指令的固件,,所以我们就刷nodemcu的 先看接线 GPIO0 默认是工作模式(不接线).如果接了低电平就是下载模式(给模块刷固件!!)所以接低电平.CH ...
- 2013 duilib入门简明教程 -- 自绘控件 (15)
在[2013 duilib入门简明教程 -- 复杂控件介绍 (13)]中虽然介绍了界面设计器上的所有控件,但是还有一些控件并没有被放到界面设计器上,还有一些常用控件duilib并没有提供(比如 ...
- 微信蓝牙设备开发教程之获取设备deviceid和二维码(3)
文章转载地址 http://www.vxzsk.com/87.html 设备授权 调用 设备授权新接口 ,获取deviceid和二维码,然后利用获取到的deviceid更新设备属性(如mac地址, ...
- IOS系列swift语言之课时二
今天我们要讲的就是函数[对于函数,在最后面还有几道题,喜欢的博友可以看了自己做一下,和我交流一下] 当然这与我们的c语言还是有一定的共同之处的,对于有一些c语言或者是java基础的童鞋,我觉得是很容易 ...