How To: Update MapObjects sample code from Borland C++ Builder 5.0 to 6.0
There are several major changes from Borland C++ Builder (BCB) 5.0 to version 6.0. As a result, the sample code does not compile properly using MapObjects without code modifications. Below are the major changes that need to be applied.
Note: There may be more changes applicable to Borland C++ Builder 6.0. For more information, please refer to the product's online help or the Borland Web site.
IMPORTANT: The latest version of Borland C++ Builder, which is fully supported for use with MapObjects 2.1-2.4, is version 5.0. For those developers who must use version 6.0 instead of version 5.0, while we hope the information in this document is found to be helpful, as it contains some lessons-learned from developers using version 6.0, ESRI can provide no assurance that developers will not experience other problems when using MapObjects in that environment.
Borland C++ Builder version 6.0 is an unsupported development environment for use with MapObjects-Windows Edition versions 2.1 through 2.4.
TypeLib Importer change: In BCB 6.0, by default, unlike BCB 5.0, IDispInterface is not used to create COM wrapper classes. Thus, no CoClasses are generated in the wrapper class so the following code fails compilation.
Code: IMoDataConnectionDisp dc = CoDataConnection::Create();
Before importing MapObjects into BCB 6.0, click the 'Use dispInterfaces in control wrappers' check box under Tools > Environment Options > Type Library. If MapObjects has already been imported without turning on this option, remove the imported MapObjects class by deleting 'Borland User Components', the default location where MapObjects wrapper class resides in BCB, from Components > Install Packages.
Path name change: When BCB 6.0 opens projects written in BCB 5.0, it performs an automatic project file upgrade. However, this upgrade operation does not update path names pointing to old libraries or package files. When compiling the project in BCB 6.0, the compiler still seeks the libraries in the old locations. As a remedy, use a text editor, such as Notepad, to open the .bpr file and replace all instances of 'CBuilder5' with 'CBuilder6'.
Variant type variable change: In previous versions of C++Builder, the Variant RTL class made direct calls into the Windows Variant API. The Variant class now makes calls through the Variant routines in Variants.pas. As a result, many conversion operators converting between build-in types and Variant are not available, so the explicit type case has to be done manually. For example:
Interface change: COM class wrapper used to be implemented with a conversion operator between IDispatch interface and CoClass interface. Now this conversion operator does not exist in BCB 6.0. In many cases, it is not necessary to cast the CoClass to (IDispatch *) as was done in BCB 5.0. For example: