3rd party libraries in MonoTouch?
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开发者_Python百科 the question: Can someone explain to me how 3rd party libraries both written in Objective-C or C# can be used with MonoTouch?
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:
- Monowiki on Obj-C bindings
- Google code project with some of the more popular libraries partly binded
(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).
精彩评论