Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I want to build a SyncML parsing library (no UI) which should be able to build up messages based on information provided by the host application, fed in by the library's methods. Also, the library should to be able to do callbacks to methods in the host application.

I want to be able to compile this and have it available on as many platforms as possible: Windows, Windows Phone 7 OS, OSX, iOS, Linux, Android, BlackBerry. Basically as many platforms as possible.

The priority is to have this available on mobile devices.

Questions:

  1. What setup should I use? (programming languages, compilers, IDE etc.)
  2. How would I compile this library for these different platforms and how would I connect to it?
  3. Any other info? e.g. articles that cover the subject of cross-platform development?

I haven't done this sort of a cross-platform project before, so any available information to put me in the right direction would be welcomed.

Myself, I have a background in C#/.NET and Objective-C.

share|improve this question

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

closed as too broad by gnat, MichaelT, GlenH7, Jonathan Eunice, amon Dec 10 at 19:53

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers 4

up vote 8 down vote accepted

Using the Java platform / JVM would be the obvious choice - it has the widest cross-platform coverage of any language, and if you have a C#/.Net background the concepts will be very familiar.

Note that you don't have to use Java language to gain the benefits of the Java platform - in fact nowadays, if starting a project from scratch I'd probably recomemnd one of the following:

  • Scala - if you want a powerful, statically typed, multi-paradigm langauge with great performance on the JVM. Could suit you if you have a C# background.
  • Clojure - if you prefer functional programming, like dynamic languages and enjoy living on the cutting edge. Clojure has truly excellent concurrency capabilities which may be appealing - the linked video is well worth watching for some deep insights.
  • Groovy - if you want a simple-but-effective dynamic object oriented scripting language that will feel very familiar to C#/Java developers.

All these languages get all the benefits of being on the JVM (fantastic JIT compiler, very effective garbage collection, a huge set of libraries) but are much more productive languages to work in.

By the way, there's already an open source SyncML library available in Java called Funambol. Not sure of the extent to which this is useful directly to you but it's an example of the fact that there is usually an open source Java library for pretty much anything.......

Thoughts on other options:

  • C/C++ can certainly work cross-platform, but it requires a recompile (and subsequent testing) into native code for each platform. With JVM languages that isn't necessary as the compiled bytecode itself is portable. Unless you absolutely need C/C++ for performance or access to raw hardware features, I think it is a headache you should avoid.
  • C# in the form of Mono could work (witness the success of Unity as a cross-platform library for example), but it's nowhere the JVM ecosystem in terms of maturity, library availability or even raw performance. Also it's never going to be 100% compatible with Microsoft .Net since .Net has windows-specific features which are a nightmare for portability. Still, worth considering if you are determined to stick with C#.
  • Javascript might be an outside option if you are interested in using the library on both the client and server side.
share|improve this answer
1  
Thanks for the great answer. Do you know how well one can port Java to the iPhone, in the form of a library or framework? Also, can't use Funambol, the point is to make my own library. –  Andrei Nov 25 '11 at 11:04
2  
I understand Apple are being quite restrictive about Java on the iPhone at present. I expect market pressure will cause it to happen more in the future - this article theserverside.com/discussions/thread.tss?thread_id=63072 for example talks about Oracle demonstrating a Java-based app in the iPod Touch. –  mikera Nov 25 '11 at 11:21
    
+1 for educating me on not needing to use Java per se, but one can use Scala, Clojure, Groovy. Fascinating answer. –  Anthony Aug 25 '12 at 9:29

.NET is hardly available on many platforms, and Objective-C is even worse, plus .NET is kinda slow and ObjC has basically no support outside Apple. C as a language is basically not even worth considering unless some external factor makes you use it.

The only result viable language is C++.

share|improve this answer
2  
Do you know anything about the advantages of using the Mono project in combination with C#? Why isn't C worth considering? –  Andrei Nov 24 '11 at 16:23
2  
@Andrei: As far as I know, Mono is hardly the picture of availability on all the platforms you've listed. And C isn't worth considering because it's just like C++, but with all the good features cut, which is obviously a stupid thing to do if you can use C++. –  DeadMG Nov 24 '11 at 16:32
3  
@DeadMG: I'd love to see you debate that point with Linus Torvalds: thread.gmane.org/gmane.comp.version-control.git/57643/… - not saying that he must be 100% right, I'd just like to watch the flamewar. –  Michael Borgwardt Nov 24 '11 at 17:15
1  
@Michael: I will not, in fact, have a flamewar. –  DeadMG Nov 24 '11 at 18:30
2  
@WTP: He asked for a recommendation, not my life story. The simple fact is that whatever you think of C++'s extra features, the fact is that they exist and they make C++-only code accessible, which is a bonus, and C is nothing C++ isn't- the reverse is not true. When you use C++ over C, you only add choices. Therefore, by definition, C++ is a superior language, and you can always choose not to use the C++ features. Which would be insanity, but you can. –  DeadMG Nov 24 '11 at 22:16

This is not one choice but many. While it is tempting to find one thing that goes everywhere, it is not always the best way to do.

  1. For example, while it may be possible to squeeze a C++ code in Windows mobile platform, anything .NET will always be easier here than its' counter part from the point of view of support.

  2. Similarly, one needs to make a major choice whether you want it to be native or under run time and are you strictly limited to Web centric or more generic powerful one? For example, Adobe Runtime is more omnipresent but it will limit to what you can do compared to with core programming languages.

  3. Most important thing i guess, is the type and level of GUI you want to built.

Now comming to most promissing choices.

a. For Symbian, Blackberry, Android, BREW and Bada (samsung) Java/J2ME is the commonest way. Though, you might be better of with C/C++ in many cases, for native core stuff in some platform.

b. For Windows .NET with any supported language would be good.

c. For iOS - there is no choice but Objective C. This is NOT very much C++ so i won't count it as a objective

Here is a wiki reference which shows set of all platforms that shows you all options and where they apply.

Thanks to your question, i learned from the above wiki link that there are now SDKs, that try to solve above problem. The two that comes closest are:

  1. Marmalade : http://www.madewithmarmalade.com/marmalade/supported-platforms this interestingly support almost all platforms. Windows is just about getting added to make complete circle.

  2. Particle Code : http://www.particlecode.com/

I have not used them yet, but sounds interesting work.

share|improve this answer
    
Android provide Bada and iOS allow C++. –  Klaim Nov 25 '11 at 0:24

You might want to try Java - Java Runtime Environment (the virtual machine) is cross platform, Java may be used in mobile devices with Android (or with Java ME) and .NET is very simillar to it.

share|improve this answer

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