Mac OSX中的@executable_path, @load_path和@rpath的理解(网摘)
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
- 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的理解
本文转载自:https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath.个人觉得写的很不错,简洁明了. Absolute path ...
- [图文详解] 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系列的移动开发环境的 ...
随机推荐
- mybatis学习笔记(二)-- 使用mybatisUtil工具类体验基于xml和注解实现
项目结构 基础入门可参考:mybatis学习笔记(一)-- 简单入门(附测试Demo详细过程) 开始体验 1.新建项目,新建类MybatisUtil.java,路径:src/util/Mybatis ...
- doPost或doGet调用出错(状态代码为405) : HTTP method GET is not supported by this URL
最近做servlet发现了个问题,解决办法记下来: Servlet eroor:HTTP method GET is not supported by this URL 错误提示: type: St ...
- c++调用python系列(1): 结构体作为入参及返回结构体
最近在打算用python作测试用例以便对游戏服务器进行功能测试以及压力测试; 因为服务器是用c++写的,采用的TCP协议,当前的架构是打算用python构造结构体,传送给c++层进行socket发送给 ...
- JS操作数组常用的方法
JS操作Array对象的方法 concat(arr1,arr2,...):连接数组indexOf(value):返回数组中value的第一个索引join(separator):将数组中所有的元素连接由 ...
- CentOS-7.2安装Ambari-2.4.2
一,Ambari 是什么? Ambari 跟 Hadoop 等开源软件一样,也是 Apache Software Foundation 中的一个项目,并且是顶级项目.目前最新的发布版本是 2.4.2. ...
- [luogu]P1352 没有上司的舞会[树形DP]
本Lowbee第一次写树形DP啊,弱...一个变量写错半天没看出来...... 题目描述 某大学有N个职员,编号为1~N.他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点 ...
- MySQL巧用自定义函数进行查询优化
用户自定义变量是一个很容易被遗忘的MySQL特性,但是用的好,发挥其潜力,在很多场景都可以写出非常高效的查询语句. 一. 实现一个按照actorid排序的列 mysql; Query OK, rows ...
- (转)Linux修改SSH登录欢迎语
场景:感觉这样做挺个性的,做个记录! 1 Linux修改SSH的欢迎语 众所周知,Linux系统并没有像Windows一样自带远程桌面连接,虽然可以通过后期安装VNC之类的软件来弥补这个缺点,但用了L ...
- vc++MFC开发上位机程序
用vc++MFC开发过不少跟单片机通讯的上位机程序了.搞懂了MFC架构,开发还是很快的,与底层单片机程序通讯,可以用串口.usb.网络.短信形式.串口现在用的越来越少了,一般电脑跟单片机在一块,使用串 ...
- Mybatis Dynamic Query 1.0.2版本
项目地址:https://github.com/wz2cool/mybatis-dynamic-query 文档地址:https://wz2cool.gitbooks.io/mybatis-dynam ...