Jump to content

Convert Source Code

Recommended Posts

Is it possible to take the source code for a program that is meant to be run on a Unix system and *easily* convert it into code that is usable on a DOS system (aka Windows)?

I was wondering this because I have heard of ports of programs, and was wondering the difference between ports and completely rewritten applications. Also, having recently become fed up with IE7, but not wanting to jump on the Firefox band wagon, I was hoping I would be able to convert my favorite Unix browser Konqueror into a PC friendly format.

Any pointers? Suggestions? Comments? Otherwise? Thanks in advance for any feedback.

P.S. - I know it is possible to run Konqueror through an independent Unix shell (I am doing it currently), but why do that if it is possible to run it natively?

Link to comment
Share on other sites

In general:

(Let's assume C++ :) )

In general: The simple case is when code is written cleanly by ANSI standard (ANSI C, or standard C++).

With such code should not be problems to take it and create project in MS Visual Studio or Metrowerks Code Warior (for Mac) or any devel tool for anu other OS.

If it will contain some system-specific functions, you must to create superseeding functions in devel environments for other OS and this is begin of "rewriting".

Problem is that konqueror uses graphical output that is mean it cannot be written in clean ANSI C,C++. My assumption is that it contains some part which we can to name: "core of application" - this is probably easy to port - this part should contain small amount of system-specific functions and then this part of code must be linked with some GUI library which is responsible for displaying buttons, trees and other GUI items...

You must to determine what GUI interface (what GUI library) is used and then to find if there exist this GUI library for other systems. For example Gimp (application for creating pictures - it is available on Linux and also on Windows - it uses GTK++ I think and for this reason on Windows must be also with it installed GTK environment).

You must also to find layer (interface) konqueror "core" uses on lower side. For example this code reads content of directory - to display it in konqueror output. If it uses for this purpose C Run-Time library then it is simpler case because it is less work with porting that if it uses Linux-specific functions for it.

To be more exact it is needed to study konqueror code and make deep analyse.


Link to comment
Share on other sites

Piorted programs usually are edited versions of the originals. The reasone for the edits are

1) Convert \LF to \LF \CR for windows (\LF = Line Feed, \CR = Carrige return. in c or c++ thats \n and \r)

2) Edit any code specific to the OS, eg network programming, directory handlin etc

3) Change any GUI specific code. Some convert from KDE code to wxWidgets so it can be run on all OSes

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for all of the help guys. I see that I can get code converters and do it now! But instead of a lazy group response, I'll respond to you all personally (since you responded personally to me)


Thanks for the suggestion man, but that is still running a Linux app through a bash shell. Interestingly enough, though, that method that you linked to makes it so that instead of running the bash shell on your machine, you hook up to a server that iss running the shell and run Linux apps on your system through the server. Pretty nifty.


You are 100% correct. What that means to me, however, that since Konqueror runs on KDE, I would have to individually convert all of the KDE base files. Sucks to be me.


Yep. Same as John, but more compact.

I found out that KDE 4 is going to come Windows compatable, though, and that it should be out early next year. I guess I'll just wait. Thanks for all of the help though!

Link to comment
Share on other sites

whenever i program in C++, first thing that comes in mind for me is cross-platform programming.

already mentioned wxWidgets is one of the examples that provides a cross-platform implementation.

also take a look at boost library, (its already suggested to become a part of STL), it contains many classes that are cross-platform but are just missing from STL, it has regex, and much more...

FMOD is a cross-platform sound library, even works on consoles.. OpenGL is also cross-platform (depends on video card though)

if you just stick with these kind of libraries you should have no problem compiling for diffrent platforms.

as for code conversion... do you mean take a code programming with winapi/mfc and convert it to kde or w/e... thats going to be a pain in the a**.. and not most likely not worth it, might even be easier to just fix wine to properly run windows applications.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...