Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a MonoTouch binding from a .framework

I downloaded TouchDB, a "lightweight Apache CouchDB-compatible database engine suitable for embedding into mobile or desktop apps", which gives me a bunch of .framework folders (CouchCocoa.framework, TouchDB.framework and TouchDBListener.framework).

I've been reading the article on binding Obj-C libraries to MonoTouch, it shows how to bind a .a, but not how to bind a .framework.

How do I make a binding for these .framework? or should I somehow make a .a of these .framework before using them (if that is even possible)?

--EDIT--

related : https://bitbucket.org/LouisBoux/touchdb-monotouchbinding

like image 677
Louis Boux Avatar asked May 14 '12 15:05

Louis Boux


1 Answers

Bind a .framework in MonoTouch takes several steps, a .framework is a directory that usually houses all the parts of a library package (e.g., the header files, resources and the library file). Here are the general steps needed to bind a .framework.

  • Create a bindings project like you would for a normal library file (libXXX.a)

  • The library equivalent in a .framework is the file without the extension that is at the root of the .framework directory, for example I recently wrote bindings for RDPDFKit.framework, the top level file was a file named RDPDFKit (no extension), rename this to "libRDPDFKit.a" and copy to your bindings project and add it to the project. It will create a code behind file with the supported platforms (e.g., x86, arm6, etc). All the documentation for this is on Xamarin's web site.

  • Define the bindings as you would for a normal library.

  • If the framework has a .bundle, copy this to you Program project (not the bindings project), it will need to be added as resources for the program. Add this directory to the project and all the items underneath, this is because resources in monotouch are not supported in DLLs.

  • The resulting monotouch bindings DLL will contain the entire .a file for later linking so you won't need the .a file after building the .dll.

like image 68
Kenny Avatar answered Oct 10 '22 19:10

Kenny