Example Code

Language Interface: 32-bit Borland C++ Builder

Code and Documents

Attachment

This is the GPIB language interface for Borland C++ Builder (version 1.0 and higher), a Win32 programming environment for creating 32-bit applications. You can use the Borland C/C++ language interface with Borland C++ Builder. Download the "Bc_bldr3a.exe" file (in the example.zip file, below). This file contains the declaration file DECL-32.H, the language interface file BORLANDC_GPIB-32.OBJ, and some sample programs for Borland C++ Builder version 3.0.  This download is not necessary when using the latest version of NI-488.2.  NI-488.2 includes files for all supported programming environments.

If you have Borland C++ Builder version 1.0, then you can download the corresponding sample programs (see the "Bc_bldr1.exe"] file in the example.zip file, below).

If you have Borland C++ Builder version 4.0, then you can download the corresponding sample programs (see the Bc_bldr4.exe file in the example.zip file, below).


How to Use the 32-bit Borland C/C++ Language Interface with Borland C++ Builder:

I. Overview

The 32-bit GPIB language interface for Borland C/C++ contains the following files:
DECL-32.H: Win32 C/C++ include file
BORLANDC_GPIB-32.OBJ: Win32 C/C++ language interface module. The Borland C/C++ language interface is included with the GPIB Software for Windows (2000/98/95/NT). You can download the appropriate sample applications for Borland C++ Builder version 1.0, Borland C++ Builder version 3.0, or Borland C++ Builder version 4.0.


II. Items to Include in Your GPIB Application

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

#include "decl-32.h" Next you need to include the Borland C/C++ Language Interface in your project. To add the language interface using Borland C++ Builder 1.0 or Builder 4.0:

Select the ADD TO PROJECT... item from the PROJECT menu bar

In the ADD TO PROJECT dialog box, click on the BORLANDC_GPIB-32.OBJ file to highlight it, and then and click on the OPEN button.. To add the language interface using Builder C++ Builder 3.0, add the following line to your application's .cpp file:

#pragma link "\borlandc_gpib-32"] where "\borlandc_gpib-32" is where the Borland C/C++ Language Interface is.


III.A. Compiling, Linking, and Running from the Borland C++ Builder Environment

From within the Borland C++ Builder environment, you can compile, link, and run your application. To compile and link a project, select the BUILD ALL item from the PROJECT menu. To run the project, select the RUN item from the RUN menu.


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

From the DOS command line, type in the following in order to compile and link a Console Application, called "yourprog", with the C/C++ language interface, BORLANDC_GPIB-32.OBJ:

bcc32 -w32 yourprog.c borlandc_gpib-32.obj. To run the newly created executable, type in the name of your application on the DOS command line, like so:

yourprog

IV. Console Application

Borland C++ Builder has a compiler option called Console Application (the "-w32" switch on the command-line compiler). All the GPIB sample programs are of this type. They illustrate how to use the function calls exported by the GPIB driver. It is simple to create Windows applications without knowledge of Windows Graphical User Interface (GUI) programming. A Console Application is a Windows program which uses text-based input and output, not a graphical interface. This allows you to quickly create a Windows application by using simple input and output functions like printf and scanf.

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

Contributors