Using Dylibs Inside App Bundle

你。 提交于 2019-12-10 14:04:31

问题


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.

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.

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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/20695805/using-dylibs-inside-app-bundle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!