How to compile my application to an executable?


I can't compile my application to an executable from within the XBasic PDE, how can I achieve this?

Win32 (Win9x / NT)
Xwindows (Linux)
Rebuild run\xb.dll
Implement XB.DLL into my executable
Doing it the easy way...




Win32


[Preparations needed before action]

Max's version: None, just take care the source is in the same directory as the XB.exe

Eddie's version: Eddie's version allows you to compile your sources anywhere you would like though
you need to run a file called
XBVARS.BAT

Compiling the sourcefile
You have to do this in the platform console mode (or a DOS box), NOT in the XBasic's integrated console window!

Your application will become build up in several extra files when you build and compile your source-code.
 
First you have to compile your source-code to assembly code. This can be easily done in the PDE by selecting menu "Run" option "Assembly"

In the console you type:

xb mysource.x
 
When compiling you will swiftly see the XB console window printing something like:

 When you ask a directory listing of mysource.* you'll notice that a few files have been added:

"mysource.s" is the assembly translation of your xbasic source-file and "mysource.mak" represents the makefile that will build up your application.

Now if you have the ".mak" and the ".s" files of your source-code you can start to build the executable with the following:
nmake -f mysource.mak

During compilation you'll notice the following:


[MaxBasic]
Your source-file is now compiled and the executable is waiting to be run, go to the "\xb\run\" directory and just run "mysource.exe"

Your "mysource.exe" is placed in the "run" directory to prevent mixing up the original xb.dll library that is placed in the "\xb\run\" directory with the xb.dll that is placed in the \xb\ directory.
"xb\run\xb.dll" is not the same as "xb\xb.dll" so never delete this one or you have to extract it again from the archive or rebuild it.

[EddieBasic]
If you compiled your source in Eddie's Xbasic version, your executable will be found right at the same folder where your source also is.
To export your executable, you take the runxb.dll you have in your \xb\bin path, copy it to the path where your executable is and rename it to xb.dll to make your executable operate properly.


Compiling in Xwindows
In Xwindows all of the above method's goes quite similar with the difference that the library will be an xlib, you use make instead of nmake.

If I'm wrong just butt-kick me since I don't have Linux / Unix.




Rebuilding \run\xb.dll or the {xbpath}\bin\xbrun.dll
My "\xb\run\xb.dll" got corrupted and so did the XB zipfile but I don't want to download the whole thing again, how can I rebuild?

You need the sourcefile of XBasic to be able to recompile the "run\xb.dll" and for the runxb.mak, I weirdly traced this one in the XBasic binary distribution but I'm not too sure; Just download and extract both source and binary distribution in the XB directory and just do the following:

nmake -f runxb.mak

In Eddie's version you can simply go to the directory where you installed the source-file and enter:
make clean
make
make install

 



Implementing xb.dll into the executable
Can I implement the XB.DLL into my executable?
I don't want my application look like it came from some kind of learning edition distribution of XBasic.


Yes you can implement the XB.DLL in your sourcefile, you can either do it in Max's XBasic sourcefile from version 6.0022 and lower as in Eddie's XBasic versions for this as the xbasic libraries need to be recompiled for implementation.
For more details how to do this click here


Note that (re)building XBasic for Windows (from Eddie PenninkHof's distribution!) requires CygWin.
Max Reason's source files do not require any third party application for rebuilding.

 



Doing it the easy way...

Okay, anyone still having problems, you may want to try this compiler package for ease... It works properly in win9x / ME,  NT and W2K, XP messes a bit around with the tool, even in compatability mode, it may work if you adjust compatability mode to NT/W2K but don't know it for sure.