Monday, November 15, 2010

How do I compile my windows programs under Linux?

Lets just imagine that we are a programming gurus. We have written all sorts of programs from spread sheets, financial, graphical drawing, GIS and even lotto programs. We have done silly little programs which move animated faces around the screen and written programs for constructing kitchens. When it comes to programming in windows there is nothing we cannot do.

Yet we see the changes in the wind. We can see that there are more opportunities to display our programming power than ever before. For many years there was really only one operating system we needed to program for and now there is a smorgasbord of choice. The currently fastest growing alternative we see is an operating system which many call Linux.

This Linux we can see is not only on computers, but also on many, many different devices and we would like to grab a piece of that pie. We would like to cut a slice of this fast growing chance to make a buck and have our cake as well as eat it too. One thing we don't want to do is have to start from scratch. We want to break into that market and break into it now! Using our already substantial code base. Yet we cannot see how to do this.

If these thoughts have been running through your head then never fear, Superman is here. Not really but the movie is on television later on and I want to watch it, again :) Even though in real life there is no Superman (although I tell my wife that I am), on the computing side of things I think that Linux is a super operating system. How super? It is super enough that you can relatively easily use your existing windows code base under Linux. No leaping tall buildings in a single bound. Just a hop, skip and a jump.

Depending on the programming language you use, you could possibly use it under Linux without any changes what so ever. To be realistic though, a small fraction of your code would be operating system dependent and those parts would need to be rewritten to be either operating system independent or adjusted for Linux. There are ways to make that process as easy and smooth as possible.

If you are a visual basic aficionado like I used to be then there is Gambas which is very similar to visual basic and you could port your code over with a minimum of work. There is also a commercial offering called Real Studio which claims to run your existing visual basic code.

For those of you who are into C and C++ then you could pretty much compile your programs directly under Linux. Provided you use standard headers and libraries. If you use things like .net then the mono project could help ease the transaction.

Then there is Borland and Delphi. It just never seems to fade away and keeps coming back. Just like Lazarus. In fact, Lazarus is the Linux equivalent to Delphi which Borland released as Kylix for use in Linux. Kylix has since been discontinued but Lazarus lives on.

Alternatively, provided you have the time and long term goals, then you could slowly port your programs to an operating system independent framework and then have them compile without changes on either operating system. There are many frameworks available, such as GTK and QT to name drop a couple.

But then, you may not even need to do that. You might be able to simply compile your programs as they are, using WINE with the provided winebuild for your custom dll's. Then you can have your programs use them. Your code will never know the difference :)

In my case, many years ago when .net was com, mfc was the rage and vb, c++ and others had not been sharpened, I took the plunge and ported my code to operating system independent status using the QT framework. Now I can flex my programming muscles on whatever operating system takes my fancy. Without any effort on my part. Can you say the same?

No comments:

Post a Comment

Post a Comment