Location:  United Kingdom  (clear)

How to run QAS Rapid C/Visual Basic API sample code

Document type: Tech doc  
Associated product(s): Product name: Rapid Version: 3.0 + Implementation: API
Views: 59  |  Created: 14 weeks agoLast updated: 13 weeks ago
Countries: United Kingdom United Kingdom 

Summary

This document outlines the steps involved in setting-up and running the Visual Basic and C sample code shipped with QAS Rapid API on Microsoft Windows or UNIX. The samples contain the code for the two different styles of test harnesses that are supplied with the product. Also included is a list of the various files and their descriptions that make up each type of sample code.

How to run C sample code for Rapid API on Windows

How to run C sample code for Rapid API on UNIX

How to run VB sample code for Rapid API on Windows

How to run C sample code for Rapid API on Windows

The sample code provided is located in the Rapid product directory.

Files provided in sample code:

File

Default Location

Description

rapui.c

C:\qaddress\rapapi32.315\c

Primary API sample code

raptrve.c

C:\qaddress\rapapi32.315\c

User Interface sample code

qaruieb.h

C:\qaddress\rapapi32.315\c

C API header file

qaruieb.lib

C:\qaddress\rapapi32.315\c

Library file which links to qaruieb.dll

1. Copy DLL and Configuration file into the project directory

You will need to copy the following files into the folder containing the sample code. This will now be called the project directory. The following files can be located within the Rapid product directory (default location C:\qaddress\rapapi32.315).

File

Default Location

Description

qaruieb.dll

C:\qaddress\rapapi32.315

DLL containing function calls

qarapid.ini

C:\qaddress\rapapi32.315

Configuration file which contains address format information

2. Check whether Rapid data file needs to be copied into project directory

Open qarapid.ini in a text editor like notepad. If qarapid.ini has the line:

DataDir=.

then copy the data file qastrt.all into this project directory. The data file is located within the Rapid data directory (default location C:\qaddress\pafdata).

3. Compile sample code

Compile the sample code (rapui.c, raptrve.c), linking this to the library file, qaruieb.lib. You will need to use a Windows compiler to do this.

Visual C Compiler

Import the qaruieb.dll and compile

Command Line Compiler

to compile: cl –DWIN32 -I. -c raptrve.c

to link: link raptrve.obj qarapea.lib /out: raptrve.exe

4. Run executable

Run the executable compiled in the previous step.

Note:

Alternatively, instead of going through steps 1-4, please run either of the compiled C test harnesses. These can be located in the Rapid product directory and are called rapuin.exe and raptrven.exe.

How to run C sample code for Rapid API on UNIX

The sample code provided can be found in /sample/c/. This should contain rapui.c and raptrve.c. Included in this directory is the makefile. This makefile can be run to compile the sample code.

Sample code

File

Location

Description

rapui.c

…/sample/c/rapui.c

Primary API sample code

raptrve.c

…/sample/c/raptrve.c

User Interface sample code

qaruicb.a

…/lib/qaruicb.a

API Library

qaruicb.h

…/lib/qaruicb.h

C API header file

1. Copy data file into the pafdata directory

The data file, qastrt.all needs to be copied from the CD into the directory …/pafdata/

2. Copy the Configuration file into the project directory

Copy the qarapid.ini file from the …/apps/ directory into the C project folder containing the C code.

3. Point the Configuration file to the pafdata directory

View the file qarapid.ini in a text editor. Edit it so that it reads

DataDir=<path to pafdata directory>

Where <path to pafdata directory> is replaced with the path to the directory located in step 1.

4. Compile the C code

Type the command:

./makefile <C code filename>

Where <C code filename> can be replaced with either rapui.c or raptrve.c. This will compile the code.

5. Run the C code

By typing the command dir, you will notice that a new file has been created. You can run this file by entering the command

./<filename>

<filename> will be either rapui or raptrve, depending on which file was compiled in the previous step.

Note:

The application also includes test harnesses which are compiled from the sample code. These can be found in the apps directory and are called rapui, raptrve. To run the C sample code, please run one of these test harnesses.

How to run VB sample code for Rapid API on Windows

The sample code provided is located in the Rapid product directory (default location C:\qaddress\rapapi32.315\VB). This has two folders, UI which is the User Interface API sample code and API which is the Primary API sample code. The following information applies to both types of sample code.

Files provided in sample code:

Files

Default Location

Description

VB project files

C:\qaddress\rapapi32.315\VB

These are files essential to the VB project. They are:

qaruieb.exe, qaruieb.bas, qautils.bas, admin.frm, main.frm, sysinfo.frm, qaruieb.vbp

qarapid.ini

C:\qaddress\rapapi32.315\VB

Configuration file which contains address format information

samples.txt

C:\qaddress\rapapi32.315\VB

List of sample addresses, used to test the integration

1. Copy the DLL and Data file into the project directory

You will need to copy the following files into the folder containing the sample code. This will now be called the project directory.

Files

Default Location

Description

qaruieb.dll

C:\qaddress\rapapi32.315

DLL containing function calls

qastrt.all

C:\qaddress\pafdata

Rapid data file

2. Open the VB project

Double click on the file qaruieb.vbp located in the project folder to open the project. You will need an installation of Microsoft Visual Basic for this to open successfully. Click on the play button. This will run the application.

Note:

The code was written in a VB version preceding Visual Basic 6.0, as a result you may experience some warning messages when attempting to launch the project. Please select “OK” to all these messages and continue with the instructions in step 2.

Related links

QAS Downloads online support area – download sample code, product manuals, and much more.

Rating

Was this document helpful?

What can we do to improve this information?