Binding Native Frameworks

Sometimes a native library is distributed as a framework. Objective Sharpie provides a convenience feature for binding properly defined frameworks through the -framework option.

For example, binding the Adobe Creative SDK Framework for iOS is straightforward:

$ sharpie bind \
    -framework AdobeCreativeSDKFoundation.framework \
    -sdk iphoneos8.1

In some cases, a framework will specify an Info.plist which indicates against which SDK the framework should be compiled. If this information exists and no explicit -sdk option is passed, Objective Sharpie will infer it from the framework's Info.plist (either the DTSDKName key or a combination of the DTPlatformName and DTPlatformVersion keys).

The -framework option does not allow explicit header files to be passed. The umbrella header file is chosen by convention based on the framework name. If an umbrella header cannot be found, Objective Sharpie will not attempt to bind the framework and you must manually perform the binding by providing the correct umbrella header file(s) to parse, along with any framework arguments for clang (such as the -F framework search path option).

Under the hood, specifying -framework is just a shortcut. The following bind arguments are identical to the -framework shorthand above. Of special importance is the -F . framework search path provided to clang (note the space and period, which are required as part of the command).

$ sharpie bind \
    -sdk iphoneos8.1 \
    AdobeCreativeSDKFoundation.framework/Headers/AdobeCreativeSDKFoundation.h \
    -scope AdobeCreativeSDKFoundation.framework/Headers \
    -c -F .