Rogue Wave banner
Previous fileTop of DocumentContentsNext file

6.5 Compiling in Windows with MSVC

This section describes how to use Microsoft Visual C++ compilers to compile programs that use Rogue Wave's DBTools.h++ class library.

6.5.1 Compiling from the Command Line (MSVC)

Here are some examples of the commands used to compile a file called myapp.cpp.


NOTE: These examples do not include any linking directives.

6.5.1.1 Static Build

6.5.1.2 Dynamic Build

6.5.1.3 Explanation

6.5.2 Compiling from Microsoft Visual Studio

To build a program that uses DBTools.h++ under the Microsoft Visual Studio development environment, you must add the Rogue Wave include path, such as <rw_root>\workspaces\WINNT<ver>\MSVC<ver>\<buildtype>, to your studio configuration. Use the menu selection Tools | Options... to bring up the options dialog. Select the Directories tab, select Include Files from the Show Directories For: drop-down box, and add the necessary include paths.

You will also need to define any macros and compiler switches required to use a particular configuration of the DBTools.h++ and Tools.h++ products.

See the Microsoft Visual Studio help system for instructions on making changes to a project configuration.

6.5.3 Using a Static Version of DBTools.h++ (MSVC)

Before starting, be sure that the Microsoft environment variables PATH, INCLUDE, and LIB are set to the proper search path for the Microsoft compiler, the system #include header files, and the libraries, respectively.

When you are using a static library:

In Table 14 and Table 15, the files marked with an asterisk (*) are located in <rw_root>\workspaces\<OS+ver>\MSVC<ver>\<buildtype>\lib. Chapter 2 explains how to interpret this path.

Table 14 -- Core library files required for an MSVC static build

 
Objects/LibrariesDescription
*\dbt#s.lib
DBTools.h++ core library.
*\tls#s.lib
Tools.h++ library.

Table 15 -- Database-specific files required for an MSVC static1 build

 
DatabaseObjects/LibrariesDescription
Informix
*\rwinf#s.obj
Required DBTools.h++ object module.
Informix
*\inf#s.lib
DBTools.h++ access library.
Informix
<INFORMIX>\LIB\iclit<ver>.lib
For example, <INFORMIX>\LIB\iclit09b.lib
Import library supplied by Informix, where <ver> is the version of your Informix installation.
MS SQL Server
*\rwmsq#s.obj
Required DBTools.h++ object module.
MS SQL Server
*\msq#s.lib
DBTools.h++ access library.
MS SQL Server
<SQLSERVER>\lib\odbc32.lib
Import library supplied by Microsoft.
DB2 CLI
*\rwdb2#s.obj
Required DBTools.h++ object module.
DB2 CLI
*\db2#s.lib
DBTools.h++ access library.
DB2 CLI
<DB2PATH>\lib\
<client_lib_name>.lib

Import library supplied by IBM for DB2 CLI, for example, db2cli.lib.
ODBC
*\rwodb#s.obj
Required DBTools.h++ object module.
ODBC
*\odb#s.lib
DBTools.h++ access library for ODBC.
ODBC
<ODBC>\lib\
<client_library_name>.lib

Import library supplied by Microsoft or ODBC driver vendor, for example, odbc32.lib.
Oracle
*\rwora#s.obj
Required DBTools.h++ object module.
Oracle
*\ora#s.lib
DBTools.h++ access library.
Oracle
<ORACLE>\oci73\lib\msvc\ociw32.lib
or
<ORACLE>\oci80\lib\msvc\ociw32.lib
or
<ORACLE>\oci\lib\msvc\oci.lib
Import library supplied by Oracle for Oracle OCI library.
Oracle8
*\rwor8#s.obj
Required DBTools.h++ object module.
Oracle8
*\or8#s.lib
DBTools.h++ access library.
Oracle8
<ORACLE>\oci\lib\msvc\oci.lib
Import library supplied by Oracle for Oracle OCI library.
Sybase CT Library
*\rwctl#s.obj
Required DBTools.h++ object module.
Sybase CT Library
*\ctl#s.lib
DBTools.h++ access library.
Sybase CT Library
<SYBASE>\lib\
<client_library_name>.lib

Import libraries supplied by Sybase for Client-Library, libct.lib, libcs.lib, and libblk.lib.
1For dynamic builds, change #s to #d in the library name and remove the object module from the list of required files.

6.5.4 Using a Dynamic Version of DBTools.h++ (MSVC)

Microsoft Visual C++ allows you to create a DBTools.h++ DLL under Windows 95 and Windows NT. To use the 32-bit DLL version of DBTools.h++, you must:

  1. Use the Microsoft runtime DLL or the debugging version of the Microsoft runtime DLL for debugging builds.

  2. Use the DLL version of Tools.h++.

  3. Define the macro RWDLL on the compiler command line.

  4. Define RWDEBUG and _DEBUG for debugging builds of the libraries.

  5. Link your program with the import libraries listed in Table 16, but not an import library for a DBTools.h++ access library DLL; the binding is made at runtime. In addition, when binding occurs at runtime, all interaction with the database server is through the access library DLL; therefore, it is not necessary to explicitly link with the database import libraries (or their wrappers) either.

  6. In Table 16, files marked with an asterisk (*) are located in <rw_root>\workspaces\<OS+ver>\MSVC<ver>\<buildtype>\lib. Chapter 2 explains how to interpret this path.

    Table 16 -- Core library files required for an MSVC dynamic build

     
    Objects/LibrariesDescription
    *\dbt#d.lib
    DBTools.h++ core library.
    *\tls#d.lib
    Tools.h++ library.

  7. When you run your program, the DBTools.h++ and Microsoft runtime library DLLs, and the database vendor libraries, must be in one of the following places:

If you get exceptions, especially in *.DLLs, and you can't figure out where they're coming from, you may have incompatible *.DLLs running. Check for incompatible .DLLs in your path.

6.5.5 Runtime Issues (MSVC)

Be sure that you have established connectivity between your client and server machines. Ask your system administrator to help set up your computer for access to the servers.

6.5.5.1 RWDBManager::database() Parameters

If you are using a static library, supply the name of the database as the first parameter for the method RWDBManager::database(). If you are using a shared DBTools.h++ access library, supply the name of the DLL as the first parameter of the method RWDBManager::database(). Table 17 lists the database name, and an example DLL name for each supported database.

Table 17 -- RWDBManager::database() parameters 

 
DatabaseDatabase nameExample DLL name
Informix
INFORMIX
inf#d.dll
DB2 CLI
DB2CLI
db2#d.dll
MS SQL Server
MS_SQL
msq#d.dll
ODBC
ODBC
odb#d.dll
Oracle
ORACLE
ora#d.dll
Oracle8
ORACLE8
or8#d.dll
Sybase Client-Library
SYBASE_CT
ctl#d.dll

6.5.5.2 Dynamic Libraries

Be sure that your PATH includes the location of your DLLs. Also be certain that you do not have "extra" versions of any relevant DLLs in your PATH. In Windows 95, set PATH in the autoexec.bat file. In Windows NT, set the path through the System Registry (the System icon in the Control Panel).


Previous fileTop of DocumentContentsNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.