2

Is it possible to use 3rd 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 3rd party libraries both written in Objective-C or C# can be used with MonoTouch?

2 Answers 2

7

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:

0
1

(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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.