Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Dylibs Inside App Bundle

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?

like image 554
Corb3nik Avatar asked Nov 02 '22 08:11

Corb3nik


1 Answers

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.

Example of a dylib in an Xcode Project

like image 179
sjs Avatar answered Nov 29 '22 01:11

sjs