This section describes how to use the Microsoft Visual C++ compiler to compile programs that use Rogue Wave's Threads.h++ class libraries.
These instructions assume that the Microsoft environment variables INCLUDE and PATH are set to the proper search path for system header files and libraries, respectively.
Suppose that we have a file named myapp.cpp and that we are compiling it in a Windows NT MS-DOS command prompt. Suppose also that our Tools.h++ and Threads.h++ header file include path is c:\rwav\workspaces\WINNT4\MSVC60\4s, and that we have built a static version for both of these products. We could then compile myapp.cpp with the MSVC compiler using the following command (all on one line):
cl -Ic:\rwav\workspaces\WINNT4\MSVC60\4s myapp.cpp c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\tls4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\itc4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\functor4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\pointer4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\sync4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\trace4s.lib c:\rwav\workspaces\WINNT4\MSVC60\4s\lib\threxcept4s.lib user32.lib
This command will compile and link in one step.
The -Ic:\rwav\workspaces\WINNT4\MSVC60\4s option tells the compiler where to find the Rogue Wave header files.
The other full path names point to the no standard library, no debugging, static Tools.h++ and Threads.h++ libraries for MSVC. (Substitute as appropriate.)
NOTE: Even if you compile a Windows NT, Windows 2000, or Windows 95 console program that uses Threads.h++, you still have to link in the user32.lib library. Tools.h++ uses it to report errors.
MSVC can build Threads.h++ as a set of DLLs. To compile your application to use the DLL version of Threads.h++, do the following:
Define the macro RWDLL on the compiler command line to configure the header files for dynamic linking.
Use the -MD or -MDd option on the compiler command line to use the release or debug version, respectively, of the Microsoft runtime library DLL.
Link your program with the import libraries for Tools.h++ and Threads.h++. The Threads.h++ libraries to link to depends on the modules you are using.
a. | Table 11 shows the names of the import libraries.
| ||||||||||||||||||||||
b. | Section 2.5 lists the possible values for buildtype. | ||||||||||||||||||||||
c. | The path to the directory containing the import libraries is: |
When you run your program, the DLLs for whatever import libraries you linked to in step 3 above, and the DLL version of Microsoft's runtime library, must be in one of the following places:
the current directory
the \WINDOWS directory
the \WINDOWS\SYSTEM directory
the directory containing the executable file for your program
a directory listed in the PATH environment variable
the list of directories mapped in a network
For Tools.h++, check the Tools.h++ Build Guide for the DLL naming conventions.
The Threads.h++ DLLs are named as follows:
functorversion+buildtype.dll
functor_listversion+buildtype.dll
functor_mapversion+buildtype.dll
itcversion+buildtype.dll
pointerversion+buildtype.dll
syncversion+buildtype.dll
threadversion+buildtype.dll
threxceptversion+buildtype.dll
traceversion+buildtype.dll
All of the DLLs are located in:
rw_root\workspaces\OS+ver\COMPILER+ver\buildtype\lib
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 the directories indicated above.
This example compiler command line (typed all on one line) builds myapp.cpp with a no standard library, multi-threaded, no debugging version of Threads.h++. The application uses the functor library from the Functor package.
cl -DRWDLL -MD -Ic:\rwav\workspaces\WINNT4\MSVC60\4d myapp.cpp c:\rwav\workspaces\WINNT4\MSVC60\4d\lib\tls4d.lib c:\rwav\workspaces\WINNT4\MSVC60\4d\lib\functor4d.lib c:\rwav\workspaces\WINNT4\MSVC60\4d\lib\pointer4d.lib c:\rwav\workspaces\WINNT4\MSVC60\4d\lib\sync4d.lib c:\rwav\workspaces\WINNT4\MSVC60\4d\lib\trace4d.lib c:\rwav\workspaces\WINNT4\MSVC60\4d\lib\threxcept4d.lib
To build a program that uses Threads.h++ under the Microsoft Visual Studio development environment, you must add the Rogue Wave include path, such as rw_root\workspaces\WINNTver\MSVCver\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.
Define any macros and compiler switches required to use your particular configuration of the Threads.h++ and Tools.h++ products.
See the Microsoft Visual Studio help system for detailed instructions on configuring Visual Studio.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.