ST-Developer for Windows supports both static and DLL versions of the ROSE C++ library and preinstalled schemas. The static libraries are 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 versions of the ST-Developer libraries are needed if you build several subproject DLLs that each must access C++ objects read or written to P21 files. The memory for the objects are managed by the shared ST-Developer DLLs and you can work with them across your DLLs.
Distributing your applications becomes a little more complex, however, because you must make sure that your programs can find the ST-Developer DLLs as well as the Visual Studio runtime.
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 ROSE_CLSDLL symbols, separated by semicolons. The ROSE_DLL symbol forces the functions and class declarations in the ROSE library to have DLL linkage. The ROSE_CLSDLL symbol does the same for the schema libraries.
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 example, the release version of an AP203 program will link to ap203dll.lib, p28e2dll.lib, and rosedll.lib. Select the Linker | Input category of properties, change the Configuration to Release then modify the Additional Dependencies property as shown below, substituting your schema library for ap203.
The debug version of the program will link to ap203dlld.lib, p28e2dlld.lib, and rosedlld.lib. In the property pages, change the Configuration to Debug then modify the Additional Dependencies property as shown below.
The DLL files are kept 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 for the rose library.
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.
As described by the "USE IN PRODUCTS" clause of your ST-Developer license, you may redistribute the DLL files found in the "dlls" subdirectory of the ST-Developer install directory. You are only permitted to do so in support of a fully linked executable for direct use by a customer. You are not permitted to redistribute them to support an SDK, DLL or other indirect application used for third party development.
As discussed in the previous section, there are many versions of each DLL. You should only include those DLLs that your application actually requires. Use the Microsoft Dependency Walker to see what ST-Developer 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.