Using PureCoverage API Functions

Related Topics

To use the PureCoverage API in native-compiled (unmanaged) code, and Visual Basic programs:

For a Visual C++ native-compiled program

You can call PureCoverage API functions from your program, or from the QuickWatch dialog box in Microsoft Visual Studio.

To call PureCoverage API functions in your Visual C++ program:

1.    Add #include "pure.h" to the header of any source file in which you want to use API functions.

2.    Add Pure_api.c, located in the PureCoverage product directory, to the list of source files in the project.

3.    In Visual Studio, select Tools > Options.

4.    In the Directories tab in the Options dialog box, add PureCoverage's product directory to the list of directories for include files.

5.    Call the API functions in your code as appropriate.

If you are working from the command line, all you need to do is add #include "pure.h" to your source file before calling the API functions. Then, assuming PureCoverage is installed in C:\Program Files\IBM\RationalPurifyPlus, type:

cl /I"C:\Program Files\IBM\RationalPurifyPlus" test.cpp "C:\Program Files\IBM\RationalPurifyPlus\pure_api.c"

To call PureCoverage API functions interactively from the QuickWatch dialog box:

1.    Add #include "pure.h" to the header of any source file in which you want to use API functions.

2.    Add Pure_api.c, located in the PureCoverage product directory, to the list of source files in the project.

3.    In Visual Studio, select Tools > Options.

4.    In the Directories tab in the Option dialog box, add PureCoverage's product directory to the list of directories for include files.

5.    Build your program.

6.    Instrument your program.

7.    Run your program in the debugger as usual. To call an API function, select Debug > QuickWatch.

8.    Type the expression you want to evaluate. For example, CoverageClearData(). Return codes are displayed in the QuickWatch dialog box and PureCoverage information is displayed in data coverage windows.

In order for PureCoverage to intercept these API functions, you must build your program with relocation data. You can build a release or debug version of your program that contains relocation data by specifying the /fixed:no and /incremental:no linker options in the Microsoft Project Settings dialog box. For more information on the recommended settings for Visual Studio .NET, Visual Studio 2005 and Visual Studio 2008, click images\shortcut.gif. For those for Visual Studio 6, click images\shortcut.gif.

For a Visual Basic program

1.    Add Vpcvbapi.bas, located in the PureCoverage product directory, to the list of source files in the project. Ensure that the PureCoverage product directory, where Vpcvbapi.dll is located, appears in your PATH environment variable.

2.    Call the API functions in your code as appropriate.

(C) Copyright IBM Corporation 1993, 2010.