Click here if you are stuck in someone else's frames.
Making a Quick Library and Stand alone Library

Let's make a library using FGRAPH.BAS.  To do so, we need to write an include file for this module.  Include files are similar in concept to header files in C except that NO executable code can be placed in them.  Here's the include file for FGRAPH.BAS.

     ' FGRAPH.BI -- by Gary Neal, Jr.
     '
     ' Include file for FGRAPH.BAS.
     ' Draws Circles and Lines on the graphics screen using floating point math.
     '

     ' Returns the angleIncr value for other modules.
     '
     DECLARE FUNCTION GetAngleIncr! ()

     ' Sets the angleIncr value for other modules.
     '
     DECLARE SUB SetAngleIncr (newIncr AS SINGLE)

     ' DrawCircle
     ' Draws a circle on the graphics screen using floating point math.
     '
     DECLARE SUB DrawCircle (xOffset%, yOffset%, radius%, C%)

     ' Line function
     '
     ' Draws a line on the graphics screen using floating point math.
     '
     DECLARE SUB DrawLine (X1%, Y1%, X2%, Y2%, C%)

Okay, now add these lines to the beginning of the FGRAPH.BAS file, before the DIM SHARED line.

     ' Our include file here.
     '$INCLUDE: 'fgraph.bi'

Now we're ready, you can do this at the command prompt or within the IDE.  From within the IDE, unload every module except for FGRAPH.BAS (you may also load FGRAPH.BI in as an include file also).  Go to the Run menu and choose Make Library, choose the options and let it fly.  At a slightly more advanced level, you can also do this at the command prompt.  First, compile FGRAPH.BAS to an OBJ.

     bc fgraph.bas

Then link it to make a Quick Library.

     link /qu fgraph.obj

Then create a stand alone library.

     lib fgraph.lib +fgraph.obj,

Some of these commands may prompt you for other information.  In general, the defaults are acceptable so just press ENTER.  If the QuickBASIC executables are not in your system's PATH, you will be prompted for the path and file name for any files it cannot find.

If you find yourself having difficulty getting all of this to work, you're not alone.  I've had lots of trial and error trying to get QuickBASIC to do what I want.  I did managed to get the files to work though.  In the end, you should have created 3 new files:  FGRAPH.OBJ, FGRAPH.QLB, and FGRAPH.LIB.  If you've done this, great, let's move on.  If not, get a copy of it by unzipping the GameLib.zip file.  Make sure you use the directory info also, like so:

     pkunzip -d gamelib.zip

The files can be found in the "GAMELIB\BASIC\RANGRAPH" directory.

Now let's use this library, at the command prompt, type:

     qb rangraph.bas /L fgraph.qlb

Make sure that ONLY the RANGRAPH.BAS module is loaded in the IDE (unload the FGRAPH.BAS file if it is found to be loaded also).  Now, make a change to the RANGRAPH.BAS file and add this line to the beginning of the file (above the SCREEN 13 line).

     '$INCLUDE: 'fgraph.bi'

It should be ready to run now, run it.  You can also make an EXE if you want.

Previous Page | Main Page | Next page