• Welcome to Jose's Read Only Forum 2023.
 

QBasic Compiled And Running Under Linux?

Started by Donald Darden, May 24, 2008, 10:24:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Donald Darden

Every once in a while, somebody asks the question about QBasic and QuickBasic, and what's the best way to move legacy code to Windows or even Linux.

Good question, and there are a range of answers.  But few answers address both Windows and Linux at the same time.  And most code would have to undergo some rewrite to work with a different interpreter or compiler.

Now the advantages of compiled code over interpreted code is much faster execution speed and tighter security.  interpreted code usually involves just a text-based file, so it's very easy for someone to examine and modify it.  For that matter, QBasic actually uses an interpreter, and QuickBasic uses a similar syntax, but works with a compiler.

But QBasic compiled?  and able to be compiled to run on Windows or Linux?
What magic is this?

Actually, it is possible, but isn't quite as straightforward as all that.  I was doing some online research, and stumbled onto a site that advertises a program called QB2C.  This stands for QBasic to C, and is a specialized parsing tool that converts QBasic syntax into ANSI-C compatible code:
http://random.com.hr/products/qb2c/qb2c.html

Any platform that provides an ANSI-C compiler and X11 graphics support can then be used to compile the resulting code.

Now there is a problem in that almost every Linux distribution uses X-windows, and can deal with X11, but Windows does not.  However, there are a few products available that add X11 support to Windows, even to Vista.  Here is one for example:
http://mediakey.dk/~cc/x11-for-windows-xp-and-vista/
and here:
http://cc.jlab.org/docs/services/windows/X11/
and here:
http://en.wikipedia.org/wiki/X_Window_System
http://x.cygwin.com/
http://gears.aset.psu.edu/hpc/guides/xming/
http://developer.apple.com/opensource/tools/runningx11.html
http://www.graytechsoftware.com/products/cadx11/index.asp

So technically, you can create an environment where your adapted QBasic
code is compiled into an executable that should work on most platforms.
Probably not the same executable, of course, but you just compile for the intended environment.