A shared library can be packaged, along with its associated resources, as a framework. To create a framework, you must build and install a shared library in a framework directory. As an example, let's package the libanswer.dylib shared library as a versioned framework, using the name ans . That is, the framework will be a directory named ans.framework , which will contain the shared library file named ans . Three basic steps are required to build a versioned framework: -
Create the framework directory hierarchy. If this is the first version of the framework on the system, the bottom level directory will be A . This is where the shared library will be installed. If you subsequently install a later version of the shared library it will be installed in a directory B at the same level of the directory hierarchy as A . mkdir -p ans.framework/Versions/A -
Build the shared library in the framework Versions directory. cc -dynamiclib -o ans.framework/Versions/A/ans answer.o -
Create symbolic links. For the first installation of the shared library (i.e., in A ), Current points to A . When a later version of the library is subsequently installed in B , the Current symbolic link will be changed to point to B . The older version in A can stay on the system in case an application needs the older version. Since the symbolic link ans.framework/ans also points the most recent version of the shared library, it will also need to be updated when the framework is updated. ln -s ans.framework/Versions/A ans.framework/Versions/Current ln -s ans.framework/Versions/A/ans ans.framework/ans |