IGES Library for Windows supports both static and DLL versions of the library. The static library is the best choice for a single project that builds an "exe" file, because the application is simple to distribute and only depends on the Visual C++ runtime files.

The DLL version of the IGES library is needed if you build several subproject DLLs that each must access the IGES C++ objects. Memory for the objects is managed by the shared IGES DLL and you can work with them across your application DLLs.

Distributing your applications becomes a little more complex, however, because you must make sure that your programs can find the IGES DLL as well as the Visual Studio runtime.

Project Settings

Begin by configuring your project settings as you would for using static libraries. Then add two preprocessor defines and adjust the names of the libraries as described below.

Within Visual Studio, select your project in the Solution Explorer and bring up the project's Property Page dialog. We want to change the settings for both Debug and Release versions, so under the Configuration field, select "All Configurations".

Select the C/C++ category of properties and, pick the Preprocessor options under that. In the Preprocessor Definitions property, add the ROSE_DLL and IGESLIB_DLL symbols, separated by semicolons. The ROSE_DLL symbol forces the functions and class declarations in the ROSE library to have DLL linkage. The IGESLIB_DLL symbol does the same for the IGES library.

Next, change the libraries to the ones that link to the DLLs. These have the same prefix as the static libraries, but end with "dll.lib" for release versions and "dlld.lib" for debug versions.

For release building, select the Linker | Input category of properties, change the Configuration to Release then modify the Additional Dependencies property to link to the igesdll.lib and rosedll.lib libraries.

The debug version of the program will link to igesdlld.lib and rosedlld.lib. In the property pages, change the Configuration to Debug then modify the Additional Dependencies property as shown below.

Your project now links to the DLL versions of the IGES Library libraries.

DLL Versions

All DLL files, including the IGES DLLs, are installed under dlls in the ST-Developer installation directory, which is pointed to by the ROSE_DLLDIR environment variable. This directory is also added to your search path when ST-Developer is installed.

DLL files must use the same version of the Visual C++ runtime as your application, so we provide several copies of each DLL, each built against a different C++ runtime. Each is named using the conventions followed by the lib directories, with a trailing "d" indicating the debug runtime. If you look in the dlls directory, you will see the following rose and IGES libraries.

rose_i86_vc8.dll	- 32bit Visual C++ 8.0 runtime (VS2005)

rose_i86_vc8d.dll	- same, debug version

rose_i86_vc9.dll	- 32bit Visual C++ 9.0 runtime (VS2008)

rose_i86_vc9d.dll	- same, debug version

rose_i86_vc10.dll	- 32bit Visual C++ 10.0 runtime (VS2010)

rose_i86_vc10d.dll	- same, debug version

Or on 64bit platforms

rose_x64_vc8.dll	- 64bit Visual C++ 8.0 runtime (VS2005)
 ... etc ...

When you link to the import library for a DLL, it automatically adds a dependency for the correct DLL for your compiler version. For example, when you link to rosedll.lib, and your library link path is sent to the 32bit Visual Studio 2008 libraries, your application will try to load rose_i86_vc9.dll at runtime.

DLLs depend strongly on the version of the C++ runtime that they are linked with and an entire application should use the same runtime. If you link parts of your applications against different runtime versions, you are likely to get runtime errors when passing pointers between DLLs then calling the new or delete operators on them. This happens even when mixing the release and debug runtimes of the same compiler version.

When you distribute your application, you should only include those DLLs that your application actually requires. Use the Microsoft Dependency Walker to see what IGES, ROSE, and C++ runtime DLLs your application has been linked to. From a command line, type "depends yourapp.exe" or double click on the "depends.exe" program in the "common\tools\bin" directory under your Visual Studio install.