Advices for cross-platform dev.


lastnikita

Still Fresh
Joined
Nov 23, 2010
Messages
3
Hi, I just started developing a few stuff for win32.


I intend to soon rewrite those from scratch to allow cross-platform development.


Any advice on the best languages / tools / environment etc. to use that allow easy porting highly appreciated =)


Also, if there are any limitation for that specific platform (I mean pandora of course !), I'd be glad to know !


Of course I mean non-obious ones, I understand the screen resolution is limited, as is the cpu, or even controls etc.


But there may be some inerside contraints I don't think of immediatly (especially since I don't own one atm).


Please don't restrict your answers to that specific platform only !!


Many thanks ^^


edit: maybe I should be more specific about targets: windows and linux desktop (32/64), iphone, android, windows phone 7, pandora of course and maybe mac & symbian ?
 
Last edited by a moderator:
Hi, I just started developing a few stuff for win32.


I intend to soon rewrite those from scratch to allow cross-platform development.


Any advice on the best languages / tools / environment etc. to use that allow easy porting highly appreciated =)


Also, if there are any limitation for that specific platform (I mean pandora of course !), I'd be glad to know !


Of course I mean non-obious ones, I understand the screen resolution is limited, as is the cpu, or even controls etc.


But there may be some inerside contraints I don't think of immediatly (especially since I don't own one atm).


Please don't restrict your answers to that specific platform only !!


Many thanks ^^


edit: maybe I should be more specific about targets: windows and linux desktop (32/64), iphone, android, windows phone 7, pandora of course and maybe mac & symbian ?

C/C++


IDE's can be anything, its more the build system. I use Codeblocks as an IDE and can be setup to use many toolchains. Makefiles also work fine. Some projects i contribute to use cmake to support multiple systems. Most systems use gcc for the compiler.


SDL is about the most comprehensive library that can support many systems.


GUI's gtk and qt should work on most devices
 
Normally, Java is the go-to choice for cross compatibility, but if you want it on the Pandora that's a stretch
 
Hi, I just started developing a few stuff for win32.


I intend to soon rewrite those from scratch to allow cross-platform development.


Any advice on the best languages / tools / environment etc. to use that allow easy porting highly appreciated =)


Also, if there are any limitation for that specific platform (I mean pandora of course !), I'd be glad to know !


Of course I mean non-obious ones, I understand the screen resolution is limited, as is the cpu, or even controls etc.


But there may be some inerside contraints I don't think of immediatly (especially since I don't own one atm).


Please don't restrict your answers to that specific platform only !!


Many thanks ^^


edit: maybe I should be more specific about targets: windows and linux desktop (32/64), iphone, android, windows phone 7, pandora of course and maybe mac & symbian ?

Plain C if you want the best compatibility between platforms, otherwise c++. Plain C works everywhere (except that I'm not sure about Android?), C++ excludes most symbian systems. You just need to pick cross-platform libraries and maybe abstract a couple if you wish to have it to work everywhere with a simple recompile. It's really more up to libraries and frameworks used. Otherwise I have not much to add to the first reply you got.


Oh, right. There is a choice between SDL 1.2 and 1.3. You might want to check out more about them yourself. Most people would and will recommend 1.2, if you ask them, but take a look at the 1.3 variant if you end up using SDL.
 
Understand both your targets and constraints, then pick your tools with both of those in mind.


Even Hello World! can be programmed in a platform dependent way.


If you're looking for cross-platform support, it might be easier (from a development standpoint) to choose an interpreted language (like Python, Ruby, Javascript, etc.), since those are designed to function similarly across all the platforms they support, as well as abstract away many of the minor details that computers are really good at handling. Of course, with an interpreted language, you might have performance issues if you have a grand design for a low-end system, and you still need to make sure the end-user has the correct interpreter, unless you cross-compile the interpreted language to platform-dependent executable code (like LLVM). Tool choice should come well after (and be dependent on) your design and goals - it's full of assorted compromises like this.


Start with a polished design to inform your tool choice, then, get good at the tools you'll need to use and the rest will come naturally.


I've learned this from experience - I now have a cross-platform app that doesn't support Mac-OSX because one of the many libraries I used doesn't have Mac support.


If you're looking for suggestions on tools, you'll probably have to keep to a lower-level language, just given the number of targets you've listed. I think the iPhone itself only supports C, or some other ridiculous constraint like that, because they don't allow apps that could program other apps (which is still possible in C, just harder).


Personally, I tend to stick to Python (language) + PyGTK/PyQT/wxWidgets (UI) in Emacs (IDE). They make for a very fast turn-around (easy to develop well, quickly) that's really maintainable over time. Maintainability is one of the biggest factors for me, as 99% of any code's life is being maintained after it's written.
 
Last edited by a moderator:
maybe I should be more specific about targets: windows and linux desktop (32/64), iphone, android, windows phone 7, pandora of course and maybe mac & symbian ?
Good freaking luck.


Uh, here's my understanding, to the best of my knowledge:


Qt is amazing, has native C++ bindings and some Java and Python bindings which are rumored to be decent. It comes with its own C++ IDE that has a lot of cool features and I use regularly.


With Qt, you can nail desktop Windows, desktop Linux, and supposedly Mac (Though I've heard people complain about Qt for Mac, I don't use any Mac hardware so I can't say) It also should work on the Pandora though I haven't tried it and I suspect all the floating-point stuff in GraphicsView may be slow (Or not, who knows).


However, the iPhone is silly. IIRC you can only use Apple's Objective-C to program it, which definitely would not have Qt bindings since Qt is free and most of their users wouldn't pay to develop for iPhones. Qt is also owned by Nokia, who competes with Apple, so I doubt they're in a huge hurry to port their GUI framework to an enemy device. As far as I know, GTK+ wouldn't run on it, either.


Android is also silly, but from what I've heard they finally released something that lets you program in C / C++, and the Qt guys are working on an abstraction of windowing systems, so it's possible a Qt / Android port will exist at some point. Again, I don't think Nokia's in any hurry, so it might be a user-made port. Basically, don't count on it, but it's more likely than the iPhone port.


No idea what Symbian does, probably something wacky and locked-down like iPhone has.


Windows Phone 7 is no doubt the same, you'd have to get their proprietary SDK and agree to some license and maybe pay some money and it would all be as difficult as possible.


If you restrict yourself to desktop Linux and Pandora Linux, you can have any of the quite a load of Linux-friendly GUI toolkits: Qt (C++-only, but I love it because it's huge and can do anything), GTK+ (C by default, there is an OO C++ binding called gtkmm. GTK is kind of ugly though, so I don't like it), FLTK (Very lightweight, doesn't care much about looks, and mysteriously split into like 4 different versions. It's probably easier to setup than Qt or GTK+, and always way smaller and faster, but you might end up implementing things on your own most of the time), WxWidgets (heard it's bad, and I think it just delegates to GTK+ on some level)


If you want Windows, Linux, and OS X, then you have Qt and GTK+. I've heard GTK+ is bad on Windows, but I personally have found Windows to be hostile to any sort of programming, and Pidgin uses GTK+, so it's possible to make it run on Windows.


Of course if you develop a web application, it will work decently on any device with Internet. (assuming you don't use Flash or Java Applets) But as the saying goes, "A developer has a problem, and he decides to build a web application. Now he has two problems."


Edit: If you don't need a GUI, then you can use almost any popular language (C, C++, Python, Ruby, JavaScript, PHP, Java, LISP, Lua) unless you're on a cell phone, because cell phone makers are all stupid and insist on proprietary programming tech whenever possible. Android is mostly developed in Java, but I heard they opened up C / C++ recently, iPhone is Objective-C only, Symbian probably does something stupid.


Of course you could port the Python VM to Objective-C and run your Python program on the iPhone that way... It would be a total pain.


Hopefully now you can understand why cross-platform things are such a pain. Because of the ****ing cell phone manufacturers. IT IS SERIOUSLY ALL THEIR FAULT.
 
Last edited by a moderator:
Of course you could port the Python VM to Objective-C and run your Python program on the iPhone that way... It would be a total pain.
no you couldn't, apple wouldn't let a python interpreter into the app store, would be competing with their native programming XD


android has the NDK, so you can program in c, but it's discouraged unless for performance critical bits of code, as not all android phones are the same architecture etc, causes compatability issues
 
no you couldn't, apple wouldn't let a python interpreter into the app store, would be competing with their native programming XD


android has the NDK, so you can program in c, but it's discouraged unless for performance critical bits of code, as not all android phones are the same architecture etc, causes compatability issues
Oops, I forgot that. You'd only be able to use it on whatever system you loaded it on manually, and since Apple is stupid, you can't just post it online and let people download it.


Wait, don't some video games embed scripting languages in their levels? Or do the iPhone versions have to convert it all to Obj-C code as the cost of admission?


Edit: And there seems to be a decent market of jailbroken iPhones, from the people who would rather fight for their device's freedom than just buy a device that's already free.
 
Last edited by a moderator:
Back
Top