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系列的移动开发环境的 ...
随机推荐
- 一款好用的绘图软件gnuplot
漂亮的图片在一篇报告中是必不可少的.这里推荐一款绘图软件Gnuplot. Gnuplot是一种免费分发的绘图工具,可以移植到各种主流平台,无论是在Linux还是在Windows都易于安装使用.最新的版 ...
- Redis配置文件redis.conf参数配置详解
########################################## 常规 ########################################## daemonize n ...
- RecyclerView-------之GridView模式加载更多
随着RecyclerView的出现,Listview.GridView的使用率相对有些减少,废话不多说,先看一下效果: 代码如下: 1.自定义的RecyclerView(根据自己的需要) public ...
- Java之字符串String,StringBuffer,StringBuilder
String类: String类即字符串类型,并不是Java的基本数据类型,但可以像基本数据类型一样使用,用双引号括起来进行声明.在Java中用String类的构造方法来创建字符串变量. 声明字符串: ...
- 我眼中的ASP.NET Core之微服务 (二)
前言 接上一篇. 上一篇未完待续的原因是当时刚好是6-30号晚上马上12点了还没写完,然后我想赶在7月1号之前发出去,所以当时就发了.然后在发的时候出了一点问题,结果发出去的时候刚好是 7.1号 00 ...
- log4go的全局封装Wrapper和标准log库函数的兼容
方便易用的全局函数 大多数时候,只不过是写一个简单的测试程序.例如: package main import ( "log" ) func main(){ log.Fatal(&q ...
- 事件冒泡、事件委托、jQuery元素节点操作、滚轮事件与函数节流
一.事件冒泡定义 事件冒泡是指在一个对象触发某类事件(比如单击onclick事件),如果此对象定义了此事件的处理程序,那么此事件就会调用这个处理程序,如果没有定义此事件处理程序或者事件返回true,那 ...
- Phpcms 前台页面实现分页
phpcms开发就是模仿里面原有的方法进行扩展,前台要实现分页,就去找后台页面的分页实现. 如后台 扩展->后台操作日志,就有分页展示. 1.先去添加自己的分页方法(千万不要在原来的方法上修改, ...
- Jmeter之处理session、cookie以及如何做关联
具体描述问题之前,我们先了解下session.cookie session.cookie的概念 1.session是放在服务器上的,过期与否取决于服务期的设定,cookie是存在客户端的,过去与否可以 ...
- 【javascript】继承
1. js 其实是一个非面向对象的语言,通过对象的深浅复制完成继承 2. 继承方法 继承的方法有两种 1)prototype 原型模式 举个例子 var Animal = function () { ...