views:

69

answers:

3

I'm tasked with "porting" a few apps from a Windows environment to various mobile platforms and Mac as well.

I plan on writing MVC patterned apps in which I write as many controllers as I can in some sort of universal library, probably in C or C++. Then writing the views in various choice languages (Objective C, Java, .NET, whatever) for the target OSes.

I've never attempted anything like this before, so my questions are: Is it possible to write and compile one library that can be used on iPhone, Android, Blackberry, Windows and Mac? Is it even wise to try this?

I understand that certain native methods simply won't be available on each platform.

+2  A: 

You can create a library whose source code is portable, assuming that you properly abstract away any platform-dependent calls. You can't, however, create such a library, compile it, then use it anywhere; you'll have to compile it for each platform.

Adam Robinson
Yeah, I figured I would have to compile for each platform. I guess I should've mentioned that. Thanks for the tip.
blesh
Are there any best practices you'd recommend for this? I mean, have you dealt with this scenario before?
blesh
Honestly, I can't recommend this. Trying to maintain a library that doesn't use any platform-specific features (and actually does something) is extremely difficult and usually not worth the effort. Because there is no development platform that applies to all of your target deployment platforms, you have to abstract away literally *everything* except for your own types and maintain specific libraries with all of these abstractions for every target platform.
Adam Robinson
A: 

There are services like Rhomobile and Appcelerator which will allow you to do this sort of cross compiling.

I've never used either however.

Rob Stevenson-Leggett
+1  A: 

Your should take a look at the Mono Project. http://www.mono-project.com

...more specifically at :

MonoTouch: To develop iPhone applications in .NET

MonoDroid (BETA): To develop Android applications in .NET

Mono plugin for MeeGo: To develop MeeGo applications in .NET

And you know that you can develop on Windows Mobile in .NET already.

I've haven't found anything related to BlackBerry yet.

Pierre 303