Example Code

Language Interface: 16-bit Microsoft QuickBASIC for DOS

Code and Documents

Attachment

This is the GPIB language interface for Microsoft QuickBASIC (version 4.0 or 4.5), a DOS programming environment for creating 16-bit applications. Download the Qbasic.zip file (in the example.zip file, below). This file contains the declaration file QBDECL.BAS, the language interface file QBIB.OBJ, and some sample programs.


How to Use the Microsoft QuickBASIC Language Interface:

I. Overview

The 16-bit GPIB language interface for Microsoft QuickBASIC contains the following files:

QBDECL.BAS: Microsoft BASIC program declarations
QBIB.OBJ: Microsoft BASIC language interface object module

If you have the GPIB Software for DOS, the QuickBASIC language interface and the sample applications are located in the directory called \QBASIC (where is where the GPIB software for DOS is installed).


II. Items to Include in Your GPIB Application

You must include the following line at the beginning of your application:

'$INCLUDE: 'QBDECL.BAS'

Next you need to link in the QBIB.OBJ file to your application.


III.A. Compiling, Linking, and Running from the QuickBASIC Environment

Before you can run an application, called yourprog, from within the QuickBASIC interactive environment, follow the steps listed below:

1. From the DOS command line, create an object module library called QBIB.LIB, by typing in the following:

LIB QBIB.LIB + QBIB.OBJ;

2. From the DOS command line, to create a QuickLibrary called QBIB.LIB that is linked with the QBIB.OBJ language interface, type in:

LINK /Q QBIB.OBJ,,,BQLB40.LIB; (for QuickBASIC version 4.0)

or

LINK /Q QBIB.OBJ,,,BQLB45.LIB; (for QuickBASIC version 4.5)

NOTE: Please remember to include the three commas between QBIB.OBJ and the BQLB4x.LIB.

3. To invoke the QuickBASIC environment where you can run the application called yourprog, type the following on the DOS command line:

QB YOURPROG.BAS /L QBIB.QLB


III.B. Compiling, Linking, and Running from the DOS Command Line

To run an application, called yourprog, from the DOS command line, follow the steps listed below:

1. To compile the BASIC application, called yourprog, type in:

BC YOURPROG;

2. To link the BASIC application, called yourprog, with the QBIB.OBJ language interface, enter the following:

LINK YOURPROG.OBJ QBIB.OBJ;

3. To run the application, called yourprog, from the command line, type in:

YOURPROG

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors