views:

92

answers:

7

If a particular piece of software is made to be run on one platform and the programmer/company/whatever wants to port it to the other, what exactly is done? I mean, do they just rewrite linux or windows-specific references to the equivalent in the other? Or is an entire rewrite necessary?

Just trying to understand what makes it so cost-prohibitive that so many major vendors don't port their software to Linux (specifically thinking about Adobe)

Thanks

+2  A: 

this is the point of a cross-platform toolkit like qt or gtk, they provide a platform-agnostic API, which delegates to whichever platform the program is compiled for.

some companies don't use such a toolkit, and write their own (for whatever reason - could well be optimisation-related), meaning they can't just recompile their code for another os.

oedo
A: 

If the software was written for a single OS, a major rework is likely. The first step is to move absolutely all platform-specific code into a single area of the code base; this area should have little or no app-specific stuff. Then rewrite this isolated portion of the code for the new target OS.

Of course, this glosses over some extremely major implications. For instance, if your first version targeted the Win32 API, then any GUI code will be heavily tied to Windows, and to maintain any hope of preserving your sanity, you will need to move all that code to a cross-platform GUI framework like Qt or GTK.

Marcelo Cantos
A: 

Porting a piece of software that has not been made platform-independant upfront can be an enormous task. Often, the code is deeply ingrained with non-portable APIs, whether 3rd party or just OS libraries. If the 3rd party vendor does not provide the API for the platform you are porting on, you are pretty much forced into a full rewrite of that functionality, or finding another 3rd party that is portable. This only can be awfully costly.

Finally, porting software also means supporting it on another platform, which means hiring some specialists, and training support to answer more complex queries.

In the end, such a process can be very costly, for very little additional sales. Sadly, the decision is easy: concentrate on new functionality on your current platform that you know your customers are going to pay for.

small_duck
A: 

Under Mono, you can write a C# Winforms program that works on both platforms. But to make that possible, the Mono team had to write their own Winforms library that essentially duplicates all of the functions of Winforms. So there is still no free lunch.

Robert Harvey
A: 

Most software is portable to some extent. In the case of a C app - there will be a lot of #ifdefs in the area, apart from path changes, etc.

Rarely windows/linux version of the same software don't share a common codebase - this would actually mean that they only share a common name. It's always harder to maintain more codebases, but I think that the actual problem with porting applications has little to do with the technical side and a lot with business side. Linux has much fewer users that Windows/OSX, most of them expect everything to be free as in beer or simply hate commercial software on some religious grounds.

When you come to think about it - most open source software is multiplatform, no matter what language was used to implement it. This speaks for itself...

P.S. Disclaimer - I'm an avid supporter of Free and Open source software, I don't want to insult anybody - I just share my perspective on the topic.

Bozhidar Batsov
A: 

In my experience, there are three main reasons why it's cost-prohibitive to take a large existing program on one platform and port it to another: (1) it has (not necessarily purposely) extensively used some library or API (often GUI, but there are also plenty of other things) that turns out not to exist on the other platform; (2) it has unknowingly become riddled with dependency on nonstandard features or oddities of the compiler or other tools; (3) it was written by somebody who didn't know that you HAD to use some oddball feature to get things to work on the other platform (like a Linux library that isn't sprinkled with the right __declspec directives you need for a good Windows DLL).

It's much easier to write a cross-platform app if you consider that a design goal from the start, and I have three specific recommendations:

(a) Use Boost -- oodles of handy things you might ordinarily get from platform-specific APIs and libraries, but by using Boost you get it cross-platform.

(b) Do all your GUI programming using a cross-platform library. My favorite these days is Qt, but there are other worthy ones as well.

(c) Build and test EVERY DAY on both platforms, never provide an opportunity for the code to develop a dependency on only one platform and discover it only too late.

Larry Gritz
A: 

Money. It is not worth the effort for commercial companies to port to Linux, where there are few sales. Borland (for example) basically went broke porting Delphi to Linux, where no-one bought the port (except me).

anon