How to Use MonoTouch Library in Xcode Project?
I have lots of exist开发者_开发百科ing business logic in C# assemblies, and I'd like to reuse them in an iOS project.
I'd like to build a library in MonoDevelop and "reference" it from my Xcode project (to use the .NET terminology).
Is this possible? If so, how?
This is a completely unsupported feature, but...
Recent versions of the mtouch utility (late 5.x and newer) cache the AOT'd assembly code for each assembly that it needs to compile for each architecture that your project targets as an intermediate step in the build process. There's a temp directory that it will create these files in to compile them that it doesn't delete between builds (part of a build optimization).
If you look in the build output log, you'll see the gcc command-line that it uses for each *.s file (you can copy&paste the path of these *.s files or even the entire gcc line to compile each of them into .o files), but change the last gcc line to compile into *.a file or something to use in your Xcode project. Or you could possibly just copy each of the *.s files into your Xcode project (that might be easier, not sure).
At that point, you'll have your MonoTouch project in native library form.
Then you just need to read up on the Mono Embedding APIs: http://www.mono-project.com/Embedding_Mono
I don't believe it is possible, sorry.
Why not use MonoTouch? You can use it for the whole project or just the DLL (I believe).
精彩评论