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系列的移动开发环境的 ...
随机推荐
- //读取配置文件(属性文件)的工具类-ConfigManager
package com.pb.news.util; import java.io.IOException;import java.io.InputStream;import java.sql.Resu ...
- nodejs抓取网络图片转换为base64编码的图片
抓取网络图片需要加载http模块 //假定这是index.js文件 var http = require('http'); var url = 'http://p0.meituan.net/tuanp ...
- java基础05 集合
一.集合的由来? 我们学习Java,可以操作很多对象 ,存储 的容器有数组和StringBuffer,StringBuilder; 而数组的长度固定,所以不适合做变化的需求,Java就提供了集合供我们 ...
- java封装性、继承性及关键字
方法的参数传递(重点.难点)1.形参:方法声明时,方法小括号内的参数 实参:调用方法时,实际传入的参数的值 2.规则:java中的参数传递机制:值传递机制 1)形参是基本数据类型的:将实参的值传递 ...
- firefox插件开发及源码下载
在个别情况下,由于数据量巨大,造成显示性能的明显下降,此时使用c++开发firefox插件,可以提高用户使用体验. test.html: 在插件中,我们导出3个函数给js:AddStr, Pause, ...
- [Open Source] .NET 基于StackExchange.Redis的扩展
目录 简介 主从复制 备份与恢复 API AddOrUpdate GetOrAdd DeleteByPattern SearchKeys TransExcute Subscribe/Publish T ...
- NLP —— 图模型(二)条件随机场(Conditional random field,CRF)
本文简单整理了以下内容: (一)马尔可夫随机场(Markov random field,无向图模型)简单回顾 (二)条件随机场(Conditional random field,CRF) 这篇写的非常 ...
- 安装harbor私有镜像仓库
有朋友安装harbor的过程中遇到很多问题,为此写一篇最简单安装harbor的文档,希望能帮助所有刚开始接触harbor的新手.harbor的架构不做探究. 实验验环境:os --> cento ...
- java泛型(整理)
1 泛型基础知识 泛型需要理解两个关键点:1)类型擦除 2)类型转换 1)类型擦除 泛型有个很重要的概念,是类型擦除.正确理解泛型概念的首要前提是理解类型擦除(type erasure). Java中 ...
- 用gensim学习word2vec
在word2vec原理篇中,我们对word2vec的两种模型CBOW和Skip-Gram,以及两种解法Hierarchical Softmax和Negative Sampling做了总结.这里我们就从 ...