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:
@rpathinstructs 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/Foocan 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_pathor@loader_path - the down side: you now have to pass additional linker flags when building the host application (eg.
-rpath @executable_path/../Frameworksor/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系列的移动开发环境的 ...
随机推荐
- Django 学习笔记(二)
Django 第一个 Hello World 项目 经过上一篇的安装,我们已经拥有了Django 框架 1.选择项目默认存放的地址 默认地址是C:\Users\Lee,也就是进入cmd控制台的地址,创 ...
- Unity User Group 北京站图文报道:《Unity虚拟现实实战技巧》
时间来到了盛夏,北京UUG活动也来到了第八期.本次活动的主题为<Unity虚拟现实实战技巧>,为此我们邀请了4位资深的行业大神.这次我们仍然在北京市海淀区丹棱街5号微软大厦举行活动,在这里 ...
- MyBatis基础
一.大配置 <?xml version="1.0" encoding="UTF-8" ?> <!--文档类型,头文件--> <!D ...
- Hibernate框架 主配置文件(Hibernate.cfg.xml) 映射配置 说明
Hibernate.cfg.xml 主配置文件中主要配置:数据库连接信息.其他参数.映射信息! 常用配置查看源码: hibernate-distribution-3.6.0.Final\project ...
- Chromium模块和进程模型
i. Chromium基本模块 Chromium各模块层级图a) Chromium主要包括如下模块: WebKit: Safari和Chromium,以及任何其他基于WebKit内核的浏览器所共享的 ...
- JAVA高并发
一.JAVA高级并发 1.5JDK之后引入高级并发特性,大多数的特性在java.util.concurrent 包中,是专门用于多线程发编程的,充分利用了现代多处理器和多核心系统的功能以编写大规模并发 ...
- nodejs之url模块
鄙人初步学习nodejs,目前在读<nodejs入门>这一本书,书很小,但是让我知道了如何用nodejs创建一个简单的小项目.例如如何创建一个服务器啦,例如http.createServe ...
- python函数(2):函数进阶
昨天说了函数的一些最基本的定义,今天我们继续研究函数.今天主要研究的是函数的命名空间.作用域.函数名的本质.闭包等等 预习: 1.写函数,用户传入修改的文件名,与要修改的内容,执行函数,完成整个文件的 ...
- opnet的sink模块学习 分类: opnet 2014-05-18 10:28 161人阅读 评论(0) 收藏
Sink模块的状态机很简单,只有INIT和DISCARD两个,非强制状态只有DISCARD用于包的销毁.Sink模块的作用就是销毁从输入流接收到的包,并且返回关于包的一系列统计量. Init的入口代码 ...
- JAVA异常处理之finally中最好不要使用return
finally 语句块中, 最好不要使用return, 否则会造成已下后果; 1, 如果catch块中捕获了异常, 并且在catch块中将该异常throw给上级调用者进行处理, 但finally中re ...