Linker 在叮当声中,如何链接到Mach-O捆绑包?

Linker 在叮当声中,如何链接到Mach-O捆绑包?,linker,clang,instruments,Linker,Clang,Instruments,叮当声——版本 苹果LLVM版本5.0(clang-500.2.79)(基于LLVM 3.3svn) 目标:x86_64-apple-darwin13.0.0 线程模型:posix 我正在寻找编译一个文件链接到一个“插件”下 /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/ 运行 文件/Applications/Xcode.app/Contents/Applications/Instru

叮当声——版本

苹果LLVM版本5.0(clang-500.2.79)(基于LLVM 3.3svn) 目标:x86_64-apple-darwin13.0.0 线程模型:posix

我正在寻找编译一个文件链接到一个“插件”下

/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/

运行

文件/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/MemoryPlugin.bundle/Contents/MacOS/MemoryPlugin

返回

/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/MemoryPlugin.bundle/Contents/MacOS/MemoryPlugin:Mach-O 64位bundle x86_64


是否有类似于框架(.framework)和库文件(.a)的链接方式?

据我所知,没有链接到捆绑包的方式,您需要“加载”它,有效地使其所有符号可用

i、 e

[[NSBundle bundleWithPath:@”/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/MemoryPlugin.bundle“]load]

更新

MH_BUNDLE文件类型通常由运行时加载的代码使用(通常称为BUNDLE或插件)。按照惯例,此格式的文件扩展名为.bundle


您应该使用
加载和返回错误:
方法,这样,如果加载失败,您将知道原因。