views:

68

answers:

2

Is it possible to use 3:rd party libraries written in C# in MonoTouch? For example if I need to do image processing and need to make use of image processing library...

Or rephrase the question: Can someone explain to me how 3:rd party libraries both written in obj-c or C# can be used with MonoTouch?

BR

//Christofffer

+1  A: 

(re C# only)

It depends largely on what that library itself does. A lot of C# libraries can simply be referenced; the AOT then just deals with it. However, if the library does a lot of reflection (which is fairly limited), or relies on external services (P/Invoke etc), or deals with unsafe code (etc), then it isn't going to run well (or possibly at all) on iPhone.

A better answer may be to enquire with the 3rd party whether this works now or in the future (perhaps with a specific targetted dll).

Marc Gravell
+3  A: 

This answer is pretty much spot on with regards to C# libraries - in my experience of using C# libraries, as long as they run within the Monotouch subset of .NET then you'll encounter no problems simply referencing them. One of our libraries did use parts of .NET not yet supported with Monotouch and we had great difficulty getting them to work (to the point where we just rewrote the library to work for monotouch)

With regards to Objective-C; Monotouch comes with a tool called bTouch, which creates bindings from Obj-C to C'# with the use of an API definition file (which usually you will have to create yourself - or download one someone else has written). Then it is a case of running bTouch, passing this definition file, which will generate the .dll

bash$ /Developer/MonoTouch/usr/bin/btouch three20.cs -s:enum.cs 

For a full explanation and a google code project to help you get started and understand how it works better see below:

Luke
Spot on! Thanx.
Christofffer