在App Bundle中使用Dylibs [英] Using Dylibs Inside App Bundle
问题描述
我正在尝试使用Xcode编译使用多个库的应用程序.为此,我创建了一个脚本,该脚本将我所有的.dylibs
从计算机上的某个位置复制到应用程序包内的Frameworks
文件夹中.
添加必要的linker flags
和header search paths
之后,我现在必须添加我的library search paths
.
I am trying to compile an app that uses multiple libraries using Xcode. To do so, I created a script that copies all of my .dylibs
from a location on my computer to the Frameworks
folder inside my app bundle.
After adding the necessary linker flags
and header search paths
, I must now add my library search paths
.
由于我已经复制了应用程序捆绑包的Frameworks文件夹内的所有库,因此我推断必须将$(FRAMEWORKS_FOLDER_PATH)
添加到library search paths
设置中.添加失败,因为链接器找不到该目录.
Since I have copied all the libraries inside my Frameworks folder of my app bundle, I have deduced that I must add $(FRAMEWORKS_FOLDER_PATH)
to the library search paths
setting. Adding this fails, because the linker can not find that directory.
我猜想Frameworks
文件夹是在搜索library search paths
设置后才创建的.如果是这样,我应该如何使用我在应用程序捆绑包中复制的库?
I am guessing that the Frameworks
folder isn't created until after searching the library search paths
setting. If so, how am I supposed to use the libraries that I have copied inside my app bundle?
推荐答案
将.dylib
文件放在Frameworks
文件夹中是您要执行的操作,以便应用程序在运行时可以找到它们.动态链接,因此应用程序会在运行时加载它们.
Placing the .dylib
files in the Frameworks
folder is something you do so that the application can find them when it runs.. dylib
files are dynamically linked, so the application loads them at run time.
在编译时将Xcode设置为链接到.dylibs只需将.dylib
从Finder拖到您的Xcode项目中即可.我已经在附带的屏幕截图中使用一个简单的示例项目(使用libxar.dylib)展示了这一点.
Setting Xcode up to link to the .dylibs at compile time should just be a matter of dragging the .dylib
from the Finder into your Xcode project. I've shown this with a simple example project that uses libxar.dylib in the attached screenshot.
这篇关于在App Bundle中使用Dylibs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!