Is it possible to link a C# library compiled using 开发者_StackOverflow中文版monotouch with an objective-C front end in a single application, or does the app have to be all or nothing?
It is possible but you aren't going to get any help from the MonoTouch tooling and you can't get away from the fact that you still have to have the Mono runtime to execute your C# code.
In order to provide the Mono runtime to the Objective-C app, the runtime will have to be embedded into the app. The MonoTouch site has some docs on how to do this here and you can find more technical details about embedding Mono into your application here.
MonoTouch, when compiling your C# code, produces .m and .s files that are used by Objective-C to call that code. These files will need to be included in the consuming Objective-C project but MonoTouch cleans up those files after they've been used. In order to keep mtouch, the MonoTouch compiler, from deleting the .m and .s files, use the --keeptemp option when invoking the compiler. You can find a good sample Makefile here to help you figure out how to call mtouch correctly from the command line.
Finally, you will need the full version of MonoTouch in order to do this. The trial version will not generate the .s files.
精彩评论