Consuming 3rd Party ObjC Libraries

From $1
Table of contents

Step 1: Add the 3rd party library to your project

Select the project from the solution explorer and press Command (Apple)+Option+A.  Navigate to the libFoo.a and add it to the project.  When prompted, tell MonoDevelop to copy it into the project.  After adding it, find the libFoo.a in the project, right click on it, and set the Build Action to none.

Step 2: Configure the addition mtouch args for your configurations

Select the project from the solution explorer and click Project->[Project Name] Options.  Navigate to iPhone Build in the Build subsection.  You need to add the following flags to every configuration you use:

-gcc_flags "-L${ProjectDir} -lFoo -framework CFNetwork -ObjC"

  • -gcc_flags is an option to mtouch telling it to pass everything in the quotes to the native compiler.
  • -L${ProjectDir} tells the linker to look in your project directory for the library
  • -lFoo tells the linker to include the libFoo.a you added to your project earlier
  • -framework CFNetwork tells the linker to include the CFNetwork framework.
  • -ObjC tells the linker to not remove any code that it doesn't see native usage of

Step 3: Create bindings for the classes you need to consume from the native library

You can see directions on how to bind third party types here.

There are projects that are binding various popular libraries, for example the btouch-library in code.google.com.

Tag page

Files (0)

 
Page last modified 05:27, 6 Dec 2009 by Miguel