I have created lib.dylib dynamic library. I want to use that library in my application. What are the Build setting and build phase settings are required? Steps to use the library in objective-c.
Asked
Active
Viewed 5,846 times
1 Answers
2
so there are 2 ways...
1) if the Dyld is available at link time, then you just link against it. (in Xcode you add it to the link build phase of the target you are building.)
if using a framework: The headers will end up in the header search path so you can #import <framework/header.h>
them.
2) if it isn't then you will need to open the dynamic library with dlopen
, then you read in each function directly... this is much more of a specialty task, like dealing with a plug-in architecture.
there are some tricky thinks if you are supplying the dynamic lib then there are issues with the library install path being relative to the executable... but you will just have to tackle them if you hit them (start by googling @rpath
)

Grady Player
- 14,399
- 2
- 48
- 76
-
As per my understanding objc_getClassClist returns all class which are in the system.. But actually i want to achieve something like this :- i have loaded my framework using dlopen() which returns handle.. my framework contains two classes.. so using dlopen heandle pointer i want that classes only which are in the framework... so how it possible?? Please help me... and thank you for your valuable time...Can u please give me your valuable suggestion?? – user3200854 Jan 31 '14 at 06:58
-
if you control the framework you could make a global array of them... and initialize with the +load call in some class, then access them via dlloaded function or extern pointer... – Grady Player Jan 31 '14 at 16:58