How to cross-platform ?

Started by
16 comments, last by jonathanjansson 12 years, 4 months ago

1) Platform abstraction

Using a language that let you code once and run everywhere
(Such as Java, C#, or even just in time compiled codes written in Python, Lua an such)


C# and Java are not write once languages. Java was sold as one, but that is a myth. Granted, they are more portable than C or C++ in most regards, but you still need to do work on a platform by platform basis. The only language of any real complexity that managed to be write once run anywhere is basically Flash/Actionscript, amazingly enough. Not that I want you to take that as an endorsement.



I did a quick research on the web and also found these ones that might be relevant and seems still alive :
(Eclipse, Code Lite, NetBeans, XPower++)
[/quote]
Eclipse and NetBeans are very much still alive, and if you are doing Java, both good choices. NetBeans 7.1 beta is a buggy mess and Eclipse should go die in a fire, especially the C++ aspects. There are people alive that like Eclipse, but then, there are people alive that like Justice Beiber, so that isn't really saying much.


3) Writing makefiles
I've heard there are still some helpers programs for that (beside the IDE who do all the job for you) but frankly I just don't know how it works or where to start or how it works over all, basically I'm in the dark (I will mention here that I code in my free times and never really had classes about it).
I guess I've heard a few programs in this topic such as : cmake and qmake.
[/quote]

At this stage in your development, pretend this aspect simply does not exist. It is a level of complexity you simply do not need added. Note, I am not saying it is complex, there is a difference. The key thing for you to do at this stage is focus on what is important, and at this stage, this is not important.


Thanks for telling me about C# cross platform capabilities, il dig into that hoping it isn't at the cost of performance.
[/quote]

For a very long time, the biggest performance bottleneck is going to be you. Until that isn't the case, probably years down the road, do not worry about this issue. It is a point of distraction that will for the most part only cause you and your development harm.



I am well aware that creating a cross-platform application isn't a piece of cake, actually I see this as a nearly impossible task yet
[/quote]

It isn't. Frankly it isn't really even all that difficult. It is simply a distraction you needn't concern yourself with right now. Noticing a trend?

I've heard about softwares that given a complex problem (thermal analisys, lot of calculs) and yet given the exact same parametters, the same software would give different results depending on the platform you run it on. Is this true/possible and if so does using libraries specific variables avoid this problem (such as using ogre's integers rather than normal c++ integer)
[/quote]

Then that is badly written software. There are some platform specific issues like endian-ness that you will *eventually* need to be aware of, but frankly most code should behave consistently across platforms, even without taking special cases into account. In fact the further you stay away from optimization and language concepts you don't yet understand the MORE LIKELY it is your code will be portable!
Advertisement
Use As3/Flash11, and Air3 for mobile when it comes out for write once run anywhere 3D?

Use As3/Flash11, and Air3 for mobile when it comes out for write once run anywhere 3D?

I feel like Adobe's decision to abandon mobile flash, probably spells bad news for Adobe Air on the mobile too, in the long run...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Why? Canning mobile web player was a political, not technical move.

CMake. It is a 'meta-makefile' in a certain sense. Also the answer to all your woes.

Cmake generates native project files on every platform (XCode for Mac, Visual Studio for Windows, Makefiles for linux, etc.), is braindead simple to use, and handles locating dependencies automatically.


I'd second CMake but you have to be honest and say that it's script language sucks huge hairy donkey nuts. Writing a CMake lists file can be as complicated as any makefile out there because of the complicated way it tries to maintain macro replacement in the middle of a script language. For simple things, sure, works like a charm. Get much more advanced and the macro language becomes a nightmare.

I use CMake, it is the best x-plat generator solution, but misrepresenting it as easy, sorry I won't go that far. :)

Why? Canning mobile web player was a political, not technical move.

Well, sure, the Flash IDE will be re-targetted to produce native code on mobile/desktop, and HTML 5 for the web. But it will be slowly replaced by Edge.

However, one of Flash's major benefits was write-once-run-anywhere, with no need to deploy. Now you have to deploy separately for each platform, in their own app stores, and so forth. That isn't any different than the situation on iOS right now, but extending that policy to Android, Windows Phone, and every embedded TV/game console in creation, is likely to hurt platform penetration as a whole... And since Adobe is already investing is separate content creation tools for HTML 5 (which will eventually incorporate all the current benefits of Flash), I'd call it a pretty safe bet that Flash is on the way out.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

I've heard about softwares that given a complex problem (thermal analisys, lot of calculs) and yet given the exact same parametters, the same software would give different results depending on the platform you run it on. Is this true/possible and if so does using libraries specific variables avoid this problem (such as using ogre's integers rather than normal c++ integer)
[/quote]

Yes this is true/possible but should only be a problem if you run on different architectures, some languages such as Java solve this for you at the expense of some performance on low accuracy platforms, There are also fixed point math or software floating point math libraries for C++ you can use instead of the native math functions (This would also cost quite a bit of performance) (Windows, Linux and Mac OSX normally all run on x86 these days so it is not a big problem, if on the other hand you need to also run on architectures such as IA64 or SPARC then you might have to deal with this problem as they have significantly higher accuracy for things like trig functions etc than the x86 has (Even if you are using the same number of bits for your datatypes).
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
You only need to share the code on the different platforms. What IDE and build system to use can be different. It is a little extra job to maintain the build scripts but not much.

This topic is closed to new replies.

Advertisement