Objective
The objective of this sample is to help you migrate from earlier versions of VisualAge C++. For more information on migrating from earlier versions of VisualAge C++, refer to the Migrate to VisualAge C++ Version 4.0 section under Tasks.
The sample is organized in a set of steps, where each step corresponds to a the results of a stage in the migration process.
Step 1: Start
This is the application before it has been migrated. It consists of the following elements:
| File | Description |
|---|---|
| lancelot.inf | Context sensitive help |
| lancres.dll | Resource dll |
| lance.dll | Program dll |
| lance.lib | Import library for lance.dll |
| lancelot.exe | Executable |
| lancelot.hlp | Online documentation |
Step 2: Generate configuration files
In this step, the make2cfg utility is used to convert the program's makefile into a configuration file. For more information on the make2cfg utility, see Convert Makefiles to Configuration Files.
Make2cfg produces three configuration files.
Make2cfg produces separate configuration files for each independent target in the makefile which has dependencies in common with another target.
The version of the IBM Open Class Library which ships with VisualAge C++ Version 4.0 requires run-time type identification. Previous versions did not require this. Add the gen(rtti, yes) option to the compatibility options at the top of files lance.icc and lancelot.icc.
The makefile contains rules for building files
lance.lib and
lance.exp. In VisualAge C++ 4.0,
lance.lib is automatically generated when the
link(exportAll) option is specified, and lance.exp
is not needed. However, make2cfg produces entries in
lancelot.icc and lance.icc to explicitly generate
them. These entries should be removed.
The makefile contains rules for building file
lance.def. In VisualAge C++ 4.0, this
file is not needed. However, make2cfg produces
entries in lancelot.icc and lance.icc to explicitly
generate it. These entries should be removed. An entry is also
produced in lancelot.icc to produce lance.lib. It
should also be removed, and the option link(exportAll) should
be added to the options used to build lance.dll. This option
will generate the export library for lance.dll.
Step 3: Migration Build
In this step, a migration build is run on the configuration files. For more information on migration builds, see Migrate Source Files. We will first migrate lance.icc, then lancelot.icc.
To run a migration build on lance.icc using the IDE, open the project lance.icc. Select no when prompted to begin a build. Select Migration Build from the Tools menu.
A number of problems will be found. Above the line which produces each error, there is a comment explaining how to fix it. Correct the problem and re-run the migration build.
Repeat this process for the configuration file lancelot.icc.
Step 4: Combine the configuration files
Since the application is built as two projects, the IDE is not able to access all the information about the application. This can be corrected by combining the two configuration files. To combine the configuration files, in a command window enter
copy lance.icc+lancelot.icc combined.icc
In lancelot.icc, one of the sources for the target lancelot.exe is the import library lance.lib. This is not needed in the combined configuration file, and should be removed. Both lancelot.icc and lance.icc contained definition for common source files. In the combined configuration file, each source file must be defined only once. Remove the duplicate definitions. The duplicate definitions of compatibility_options should also be removed.
The combined configuration file can now be build using a regular build. Press the Build button on the IDE's toolbar, or select Build from the Project Workbook menu.
Supported
Supported
Not Supported
