Readme - Release Notes for CodeGear RAD Studio 2007

By: Dee Elling

Abstract: Important supplementary information for the RAD Studio 2007 release containing Delphi 2007 for Win32, .NET, and C++Builder.

Release Notes for CodeGear RAD Studio 2007

    Release Notes for CodeGear RAD Studio 2007

This file contains important supplementary information that might not appear in the main product documentation. CodeGear recommends that you read this file in its entirety. For an updated version of these Release Notes, see the CodeGear Developer Network (http://dn.codegear.com/article/36858).

This document refers to "the product" when the information applies to all three personalities in CodeGear RAD Studio 2007: Delphi 2007 for Win32, Delphi 2007 for .NET, and C++Builder 2007.

For information about installation, deployment, and licensing issues, see the Install, Deploy, and License files located, by default, at C:\Program Files\CodeGear\RAD Studio\5.0.

    Contents

    Installing, Uninstalling, and Upgrading Your Product

  • Before installing, uninstalling, or upgrading the product, see the INSTALL and LICENSE files for detailed information about installation and licensing issues. Also see the Installation FAQ, located at: http://dn.codegear.com/article/36523. The INSTALL.htm file gives the system and free space requirements for installing RAD Studio 2007, as well as installation and upgrade procedures.

    Where to find the INSTALL.htm file:

    After installation, the INSTALL.htm and LICENSE.rtf files are located by default at:

    C:\Program Files\CodeGear\RAD Studio\5.0\

  • Installing products in the wrong order can cause problems and should be avoided. For example:

    • Do not install Borland Developer Studio 2006 after installing RAD Studio 2007. If you attempt this combination, you will be unable to start BDS 2006. The following error occurs after you complete registration:

      Exception EPackageRegistrationException in module coreide100.bpl at 000DB245. Registration procedure, Cppproject.IDERegister in package C:\Program Files\Borland\BDS\4.0\Bin\bcbide100.bpl raised exception class EOleSysError: OLE error 80131040, ClassID: {F8FEDD39-E3CE-4B8D-A657-9CA24686881F}

      In this case, the assembly is registered incorrectly in the BDS2006 install. If .NET 2.0 and .NET 1.1 coexist on the system, the system cannot load borland.studio.toolsets.dll. The workaround involves forcing the assembly loader to use .NET 1.1 for this assembly. For more information, see:

      http://qc.codegear.com/wc/qcmain.aspx?d=28728

      http://qc.borland.com/wc/qcmain.aspx?d=22108

      http://support.codegear.com/article/36047

    • Do not install Delphi 2007 for Win32 or C++Builder 2007 from an original release DVD after you install CodeGear RAD Studio 2007. The result is that neither product gets installed.

  • The installer does not warn you when there is not enough free space to install the product. Approximately 2 GB of free space is needed on the C: drive to install RAD Studio (even if you are installing to a different drive). If there is insufficient space, the installer might hang.

  • After uninstalling CodeGear RAD Studio 2007, some system files/settings are removed and prevent any subsequent .NET 2.0 uninstall or repair until you reboot.

  • Only one set of Microsoft® Office Controls can be registered and available in the IDE at one time. Available packages include OfficeXP for Delphi Win32, OfficeXP for C++Builder, Office2K for Delphi Win32, and Office2K for C++Builder. To register these with the IDE, select Component>Install packages.

Top

    General Notes

  • About 150 code example snippets (Delphi) have been retested and restored to the online help reference pages. Note that the comments in the code snippets are in English only. The code snippets are planned to be available on the CDN CodeCentral website.
  • The demos for the product are installed in directories according to the way you install the product and whether you are using Windows Vista:
    • If you choose All Users during installation, the demos are installed in C:\Documents and Settings\All Users\Shared Documents\RAD Studio\5.0\Demos.
    • If you choose Just Me during installation, the demos are installed in C:\Documents and Settings\username\My Documents\RAD Studio\5.0\Demos.
    • On Windows Vista, if you choose All Users during installation, the demos are installed in C:\Users\Public\Documents\RAD Studio\5.0\Demos.
    • On Windows Vista, if you choose Just Me during installation, the demos are installed in C:Users\username\Documents\RAD Studio\5.0\Demos.
  • Indy10 is integrated with the product. However, you can install the earlier version, Indy9, from C:\Program Files\CodeGear\RAD Studio\5.0\source\Win32\Indy9.
  • In order to build WebAppDebugger applications with packages, you must list the Indy9 package in the runtime packages list before the Indy10 packages.

    Select Component>Install Packages.

    Add "indy;" at the beginning of the runtime packages list, as follows:

    indy;vcl;rtl;bcbie;vclx;vclactnband;xmlrtl;bcbsmp;dbrtl;vcldb;bdertl;vcldbx;dsnap;dsnapcon;teeUI;tee;teedb;vclib;ibxpress;adortl; dbxcds;dbexpress;DbxCommonDriver;IndyCore;IndySystem;IndyProtocols;inet;IntrawebDB_90_100;Intraweb_90_100;VclSmp;vclie;websnap;webdsnap;inetdbbde;inetdbxpress;soaprtl

  • To debug web applications, you should start by running serverinfo.exe, which silently registers itself. This step is required to use the Web Application Debugger (WebAppDbg.exe, located in the \bin folder of your installation directory).
  • For information about IntraWeb, including help for the VCL for the Web components, see http://www.atozed.com/intraweb/docs/.
  • It is possible for .NET Framework and .NET SDK to appear in different languages, such as English and Japanese. The .NET Framework installs all of the possible languages and then determines the language to use according to the system locale. The .NET SDK, however, installs only the language selected during installation.
  • To register a COM server, you need to run (the first time only) with /regserver as a run parameter. Follow the steps outlined here:
    1. Create a project.
    2. Save the project.
    3. Set Run | Parameters to /regserver.
    4. Run your project. The application registers and then closes.
    5. Clear the /regserver setting on the Run | Parameters page.
  • If you are a VCL Component Vendor and your component installer updates paths in the registry to include paths to your components, there is one additional registry key your installer should update in HKEY_LOCAL_MACHINE under:

    Software\Borland\BDS\5.0\Globals

    Add (or update if it already exists) a string value called ForceEnvOptionsUpdate. Assign it a string value of "1." When this registry key has a value of "1," the next time the IDE runs, it updates the EnvOptions.proj file on disk to include the path(s) that your installer added. The EnvOptions.proj file is the mechanism by which the new MSBuild build engine in the IDE is able to include paths that are listed on the Library - Win32 page in the IDE's Tools>Options dialog.

    If your installer updates any of the following registry keys, it should also add or update the Globals\ForceEnvOptionsUpdate key:

    • Software\Borland\BDS\5.0\Library\Browsing Path
    • Software\Borland\BDS\5.0\Library\Debug DCU Path
    • Software\Borland\BDS\5.0\Library\Namespace Search Path
    • Software\Borland\BDS\5.0\Library\Package DCP Output
    • Software\Borland\BDS\5.0\Library\Package DPL Output
    • Software\Borland\BDS\5.0\Library\Search Path
  • The legacy WinHelp viewer (WinHelp.exe) is not implicitly registered by RAD Studio. If you want to use .HLP files from an application, you need to add the WinHelp viewer to the uses list of any unit included in the application.

    To download the WinHelp viewer, visit the Microsoft website:

    http://www.microsoft.com/downloads/details.aspx?familyid=6ebcfad9-d3f5-4365-8070-334cd175d4bb.

Top

    Known Problems

    Cannot Use Dynamic Link RTL if Dynamically Load DLL

If you dynamically load a DLL, you can't link dynamically with the runtime library. Otherwise, an Access Violation occurs when the program terminates. The workaround is to not check Dynamic RTL in the Linking section in Project Options on the Linker\Linking page.

    Must Turn off NO_STRICT #define with GdiPlus library

The C++ library GdiPlus cannot be used in non STRICT mode, since it requires that Graphics::Graphics(HDC) be distinguishable from Graphics::Graphics(HWND). In non STRICT mode, both HWND and HDC are "void*". Otherwise, you get the error:

[C++ Error] GdiplusGraphics.h(37): E2015 Ambiguity between 'Gdiplus::Graphics::Graphics(void *)' and 'Gdiplus::Graphics::Graphics(void *,int)'

    ActiveX

The Register and Unregister menu items are not enabled if you open and run an ActiveX library project in C++ Builder 2007 that was created with C++ Builder 6. The work around is to go to Run>Parameters and set Host application to "C:\windows\system32\regsvr32.exe" and the Parameters to <ProjectName>.

Top

    ASP.NET Notes

  • To enable your ASP.NET 2.0 applications to query or create virtual directories on an IIS 7.0 web server running under Vista:

    1. Enable the IIS 6 Management Capability Feature:
      1. From the Vista Control Panel, select Programs and Features.
      2. Click Turn Windows Features On or Off. This launches the Windows Features dialog box.
      3. In the tree, select the Internet Information Services | Web Management Tools|IIS6 Management Compatibility node to enable the IIS Metabase and IIS6 configuration compatibility.
    2. Run Delphi 2007 for .NET as an Administrator.
  • Assemblies are built for 32 bit by default, so they will not run under an IIS virtual directory configured for 64 bit. If you are running an ASP.NET 32-bit application under Vista and are using IIS on a 64-bit operating system, use the following workaround:

    1. From the Vista Control Panel, select Administrative Tools.
    2. Double-click Internet Information Service (IIS) Manager.
    3. Click DefaultAppPool in the Application Pool list.
    4. Click Advanced setting at right side.
    5. Set Enable 32-bit Applications as True.
    6. Click OK.
  • To debug an ASP.NET application on the IIS web server in Vista, you must add the following directives to your project's web.config file:


    <system.webServer>
        <modules>
           <add name="DbgConnect" type="Borland.DbkAsp.DbkConnModule,Borland.dbkasp,Version=10.5.0.0, Culture=neutral, PublicKeyToken=b0524c541232aae7" preCondition="managedHandler" />
        </modules>
        <validation validateIntegratedModeConfiguration="false" />
    </system.webServer>

Top

    Blackfish SQL Notes

Blackfish SQL is a high performance transactional database that originated as JDataStore.
  • The Blackfish SQL API is available for .NET applications and for Win32 Delphi and C++ applications as well.
  • An overview of Blackfish SQL is available from CodeGear Developer Network at:

    http://dn.codegear.com/article/36770

  • The Blackfish SQL Developer's Guide can be downloaded from CodeCentral, which is located at:

    http://cc.codegear.com/


Top

    Windows VistaTMNotes

  • In Windows Vista, you must run the installer while logged on as a user with administrative privileges, because changes to the Program Files directory require elevated security.
  • The registration client occasionally fails on Windows Vista. To work around this problem, select Allow this program when the Windows Live OneCare Firewall appears, then exit and restart registration. Do not select Block this program, because doing so prevents you from registering afterward.
  • Windows Vista does not support the legacy WinHelp help viewer (WinHelp.exe). If you want to use .HLP files, you need to add the WinHelp viewer to the uses list of any unit included in the application. To download the WinHelp viewer, visit the Microsoft website http://www.microsoft.com/downloads/details.aspx?familyid=6ebcfad9-d3f5-4365-8070-334cd175d4bb. See the related item under General Notes.
  • If you use the TAnimation component in Vista, you must also add the component TShellResource under the Win32 tab to your project. Adding TShellResource adds these resources:
    • FindFolder.res
    • FindFile.res
    • FindComputer.res
    • CopyFiles.res
    • CopyFile.res
    • RecycleFile.res
    • EmptyRecycle.res
    • DeleteFile.res
  • If you are using BDE on Windows Vista, you need to reconfigure BDE so that it does not attempt to write files to the C:\<root> directory. To do this, log on as an administrator and run BDEAdmin.exe, located at Program Files\Common Files\Borland Shared\BDE. Under Native, click PARADOX, and change NET DIR to point to a location other than the root directory. A suggested target is C:\Users\Public\Documents\RAD STUDIO.
  • The computer might restart when you add a manifest that has the Windows Vista extension to an .exe file or to a .dll file in Windows XP Service Pack 2 (SP2). For more information on this problem and the hotfix, see http://support.microsoft.com/kb/921337.
  • If you rebuild an existing VCL application that includes common dialog components and run it on a Vista system, it uses Vista file and task dialogs rather than traditional open, save, and message dialogs. If this is not desired, set the global variable UseLatestCommonDialogs false at the beginning of a program to force the original behavior.
  • To run and debug VCL for the Web (IntraWeb) applications, you should use Windows 2003 or Windows XP. If you are using Windows Vista, you must turn off User Access Control (UAC) when debugging VCL for the Web applications. For more information about IntraWeb, including help for VCL for the Web components, see http://www.atozed.com/intraweb/docs/.
  • On Vista with UAC enabled, if an executable's file name includes "setup", "update", or "install", you cannot debug the program unless the IDE is started under the System Administrator account. Trying to run executable files that include these strings outside of the IDE triggers a "User Account Control" dialog requesting the password for the System Administrator account. Running within the IDE without debugging raises an error indicating the program requires privilege elevation. Running within the IDE with debugging raises a process creation error. For more information, see http://blogs.msdn.com/uac/archive/2006/01/13/512776.aspx.

Top

    C++Builder and C++ Compiler Notes

    Possible Binary Incompatibility with Previous Version of C++ Compiler

The C++ runtime libraries have been enhanced and altered to be more current, and the standard C++ libraries from Dinkumware have been updated to version 5.01. Because of these changes, the binary objects generated by the compiler in C++Builder 2007 might differ in some cases from previously compiled versions. The incompatibilities are mainly restricted to the C++ standard libraries. There are no changes in the basic C++ application binary interface (ABI).

    Delphi Interface Parameter with Default Value of nil Handled Differently
Assigning the Type void * to Delphi Interface Now Fails to Compile

The Delphi compiler (DCC32) previously generated the following code in the .hpp file when an interface parameter had the default value of nil:

  void methodName(_di_IIntf param = (void *)(0x0));

Previously the C++ compiler incorrectly accepted this syntax.

In this release, both the Delphi compiler and the C++ compiler handle this case differently.

The Delphi compiler now emits code like this in the .hpp file for an interface parameter with a nil default value:

  void methodName(_di_IIntf param = _di_IIntf());

The C++ compiler now gives an error for code that assigns the type "void *" to a Delphi interface. For instance, the line

  void methodName(_di_IIntf param = (void *)(0x0));

now fails to compile, emitting the error:

  Cannot convert 'void *' to '_di_IIntf'

If you have Delphi code containing an interface parameter with a nil default value, recompile it with DCC32. If you do not have the source, edit the .hpp file and modify all occurrences like this

  void methodName(_di_IIntf param = (void *)(0x0));

to this:

  void methodName(_di_IIntf param = _di_IIntf());

    Selecting Both of the Symbol Reference Info Options for Delphi Code

If you are compiling Delphi code inside your C++Builder project, you currently can select only one of the Symbol Reference Info options (either Definitions or Reference Info) on the Project>Options>Delphi Compiler>Compiling dialog box. However, you can select both of these options if you use source-level directives ($ xx ) as follows:
  • Definition Info ($YD) option: the Delphi compiler records information about where each identifier is defined. For most identifiers--variables, constants, classes, and so forth--the compiler records the location of the declaration. For procedures, functions, and methods, the compiler records the location of the implementation. This enables Code editor browsing.
  • Reference Info ($Y+) option: the Delphi compiler records information about where every identifier is used as well as where it is defined. This enables the References page of the Project Browser.
These compiler options are only available when both the Debugging Information ( $D ) and the Local debug symbols ( $L ) options are ON.

    Specifying WebSnap Directories

If you are using C++Builder with WebSnap, ensure that the executables are written to the same directory as the HTML files. On Project>Options>Paths and Defaults>Final Output , enter a dot (".") so that the executable is written to the project directory.

    Location Change for Precompiled Headers

C++ precompiled header files (PCH) are placed in a different file location than BDS2006. If you import a project from BDS2006, it does not import the project's PCH file location. You can set the PCH file in Project>Options>Precompiled headers>PCH filename .

    Generating C++ Files from the Delphi Compiler

If you want to generate .hpp files (and the corresponding .obj) from a .pas file, you should use dcc32.exe with the -JPHNE switch. Or use -JL on the .dpk file containing the .pas file.

    Using the Delphi DesignIntf and DesignEditors Tools

If you are creating a C++ package that contains a Delphi unit that uses the DesignIntf and DesignEditors tools, you must choose Project > Options > Delphi Compiler > Other Options. In Use these packages when compiling, add DesignIDE in the combo box.

    Using WinHelp in C++ Applications

To use WinHelp in a C++ application:

  1. Add #include <WinHelpViewer.hpp>.
  2. Refer to an object declared in the WinHelpViewer header file.

    void LinkWinHelp()

    {

      # pragma startup LinkWinHelp 66

      if (WinHelpTester != NULL)

            WinHelpTester->GetHelpPath();

    }

To download the WinHelp viewer, visit the Microsoft website:

http://www.microsoft.com/downloads/details.aspx?familyid=6ebcfad9-d3f5-4365-8070-334cd175d4bb .

    C++ Compiler Changes

To more closely obey the rules of the C++ ANSI Standard, the C++ compiler shipping with C++Builder 2007 is stricter than previous versions. Code that did not generate errors in earlier versions of C++Builder might fail to compile with C++Builder 2007. This section lists some of the common areas where the compiler is stricter. Each case is illustrated with an example showing the problem and how to update the code to compile with C++Builder 2007. Note that there are often many ways to bring offending code up to date. The appropriate method depends on the intent of the original code.

Binding of References and Qualifiers

There are many constructs that now generate error messages with the C++ compiler included with C++Builder 2007. The rules governing this are described in section 8.5.3 of the 2003 C++ ANSII standard. They fall in the following categories:

  1. Binding a non-const lvalue to to non-const reference. Use the compiler switch -Vbr to allow this.
  2. Binding a temporary to a non-const reference. Use the compiler switch -Vbr to allow this.
  3. Binding of const or volatile objects to non-const or non-volatile methods repectively. Use the compiler switch -Vbn to allow this.

Previous versions of the Borland C++ compilers allowed various forms of binding to non-const reference parameters. In the following example, for instance, one was allowed to simply cast the psize parameter:

  int takesLongRef(long& l);

  int takesUnsignedPtr(unsigned long* psize) {

     return takesLongRef((long)*psize);
  }

With C++Builder2007, the above code generates these errors:

  Error E2357 test.cpp 3: Reference initialized with 'long', needs lvalue of type 'long' in function takesUnsignedPtr(unsigned long *)

  Error E2342 test.cpp 3: Type mismatch in parameter 'l' (wanted 'long &', got 'long') in function takesUnsignedPtr(unsigned long *)

To remedy this, you can cast psize before dereferencing, as in:

  int takesLongRef(long& l);

  int takesUnsignedPtr(unsigned long* psize) {
    return takesLongRef(*reinterpret_cast<long*>(psize));
  }

Be aware of cases that involve temporaries in unobvious ways. For example, some binary operators imply a temporary:

  enum { zero, one, two } num;

  num |= two; // Not allowed
  num = num | two; // OK

Another case that involves temporaries in an unobvious way is the return value of a property. The following example illustrates code that compiled with previous versions of the compiler:

  #include <vcl.h>

  class TTest {
    WideString FData ;
  public:
    __property WideString Data = {read = FData };
  };

  void Func(WideString& wref);

  void test() {
    TTest t;
    Func(t.Data);
  }

With C++Builder 2007, the above generates two errors:

  Error E2357 test.cpp 14: Reference initialized with 'const WideString', needs lvalue of type 'WideString' in function test()
  Error E2342 test.cpp 14: Type mismatch in parameter 'wref' (wanted 'WideString &', got 'WideString') in function test()

You can fix this by changing the reference to a const reference, as in:

  void Func(const WideString& wref);

Here is an example of trying to bind a const object to a non-const method:


  struct X {
    void foo();
  };
  const X x;
  x.foo(); //error

1.1 Reconcile Error Dialog

The temporaries and references issue referred to above is encountered in code generated by previous versions of the Reconcile Error Dialog Wizard. To remedy this, look for the VarToAnsiStr method


  AnsiString VarToAnsiStr (Variant &V, TFieldType DataType)

and change it to take a const Variant&, as in:

  AnsiString VarToAnsiStr (const Variant &V, TFieldType DataType)

2. String literals are now constants

String literals are now considered to be of type 'const char[]' by default. This, combined with the stricter qualification binding of const values and types, can generate error messages in code that compiled before.

You may enable the -Vbs switch to revert string literals to non-const. However, CodeGear recommends that you update the code instead.

Note that the change in the type of string literals can also change how the compiler resolves calls to overloaded methods. The following example illustrates this:

  void foo(char *);
  void foo(const char *);
  foo("string"); // New Compiler picks foo(const char *)

3. Template Changes

The C++ compiler no longer allows an explicit template without the 'template <>' prefix. Use the compiler switch -Vbe to allow this. The following example shows this:

  template<class>
  class foo {
    foo();
  };
  foo<int>::foo(); // Error
  template<> foo<int>::foo(); // OK

Also, the C++ compiler no longer allows explicit template specialization within a class. Use the compiler switch -Vbx to allow this. For example, this generates an error:

  struct S {};
  struct SP
  {
    template <typename T> void foo(const T &) {}
    template <> void foo(const S &) {} // Error
  };

  template <> void SP::foo(const S &) {} //OK

4. Function Overload Resolution

One of the areas where the C++Builder 2007 compiler differs the most from the previous version is in overload resolution, which includes the detection of ambiguity. The compiler now better conforms to the rules in section 13.3 of the 2003 C++ ANSI Standard. Several constructs that were previously allowed might now be reported as ambiguous or no match found, requiring that you modify code to clarify its intent.

The compiler option to revert to the old behavior, not enforcing the new stricter behavior, is -Vbo. However, not all compiler changes can be controlled by this switch, so CodeGear recommends that you update the code instead.

The following is an example of an ambiguity that was permitted by the previous compiler:

  class X{};
  void foo(X);
  void foo(const X&);
  void ambig() {
    X x;
    foo(x); //error-ambiguous-the previous compiler chose 'void foo(x)'
  }

4.1 std::abs() Ambiguity

The standard abs function might also generate an ambiguity message when invoked with a parameter that does not exactly match the types expected by the various overloaded versions of abs. Here is an example:

  #include <limits>
  bool test(long l) {
    return std::abs(l) > 0;
  }

The code above generates an error and a warning:

  Error E2015 test.cpp 5: Ambiguity between 'std::abs(int) at C:\dev\tp\sc\include\math.h:208' and 'std::abs(long double) at C:\dev\tp\sc\include\math.h:275' in function test(long)
  Warning W8057 test.cpp 6: Parameter 'l' is never used in function test(long)

To fix this, cast to the type of the overload you wish to invoke. For example,

  #include <limits>
  bool test(long l) {
    return std::abs(static_cast<int>(l)) > 0;
  }


5. Initialization and Conversion

The compiler now obeys the rules of 8.5.1 and 13.3.1 of the 2003 C++ ANSI Standard for initialization and conversion:

  1. Direct initialization now requires initialization by a constructor and no longer picks a user conversion sequence.
  2. Copy initialization for objects of the same or derived type now requires a constructor call.
  3. Copy initialization for objects of the different types no longer prefers user conversion over construction. If the compiler finds a suitable user conversion, it now continues to look for (possibly ambiguous) converting constructors. If the chosen conversion function is a converting constructor, the call initializes a temporary of the destination type. The result of the call (which is the temporary for the constructor case) is then used to directinitialize the object. Use the compiler switch -Vbo to revert to the previous behavior.
  4. For an explicit cast, the compiler now performs direct initialization on a temporary.

This example illustrates the new behavior:

  // In this example, dst is destination type and src is source type
  class A { };
  class V {
  public:
    V() { };
    V( const V & ) { }
    V( const A & ) { }
  };
  class G {
  public:
    G() { }
    operator V() { }
    operator A() { }
  };
  G g; V v;
  // direct initialization
  // ==> constructors are considered.
  V v9(g);
  // Both of these statements previously compiled but now get the error:
  // Error E2015: Ambiguity between 'V::V(const V &)' and 'V::V(const A &)'

  // casts
  // (V)g is treated as V tmp(g) which is direct initialization of 'tmp'
  // ==> constructors are considered.
  (V)g;
  static_cast<V>(g);
  // Both of these statements previously compiled but now get the error:
  // Error E2015: Ambiguity between 'V::V(const V &)' and 'V::V(const A &)'

  // copy initialization with dst=V src=G
  // ==> user-defined conversion sequences are considered.
  V v4 = g;
  V v5 = G();
  // Both of these statements now compile but previously got the error:
  // Error E2015: Ambiguity between 'V::V(const A &)' and 'V::V(const V &)'

  // copy initialization with dst=V src=V
  // ==> converting constructors of V are considered.
  V v6 = (V)g;
  V v7 = V(g);
  // Both of these statements compiled previously but now get the error:
  // Error E2015: Ambiguity between 'V::V(const V &)' and 'V::V(const A &)'

5.1 Conversion via user-defined operators

The new C++Builder 2007 compiler often reports ambiguities for conversions that involve user-defined operators. An example is shown below:

  class AnsiString
  {
  public:
    bool operator ==(const AnsiString& other);
    AnsiString(const wchar_t* src);
  };

  class Variant
  {
  public:
    operator AnsiString() const;/br>     operator wchar_t*() const;
    bool operator ==(const AnsiString& rhs) const
    { return static_cast<AnsiString>(*this) == rhs;}
  };

C++Builder users might notice that the above is a stripped down version of the VCL AnsiString and Variant classes. Previous versions of the compiler invoked the 'Variant' 'operator AnsiString() const' for 'static_cast<AnsiString>(*this)', while C++Builder 2007 uses 'conversion via constructor'. Since the Variant can be converted to multiple types for which there are AnsiString constructors, the compiler generates an ambiguity error.

To correct this error, you must eliminate the cast as in:

  bool operator ==(const AnsiString& rhs) const
  { return (*this) == rhs;}

You can also be explicit about the operator:

  bool operator ==(const AnsiString& rhs) const
  { return this->operator AnsiString() == rhs; }

5.2 Variant/OleVariant/AnsiString/WideString/TDateTime

The issue described above with a user-defined conversion operator vs. conversion via constructor might be encountered in several constructs involving the VCL classes Variant, OleVariant, AnsiString, WideString, TDateTime, Currency, and so forth. The following table lists constructs that now generate error messages and the updated syntax.

Previous Construct Updated Construct Notes
AnsiString test(OleVariant v) {
  AnsiString ret = (AnsiString) v;
  return ret;
}
AnsiString test(OleVariant v) {
  AnsiString ret = /*(AnsiString)*/ v;
  return ret;
}
Do not cast RHS when relying on conversion operator in an assignment.
WideString test(OleVariant v) {
  WideString w(v);
  return w;
}
WideString test(OleVariant v) {
  WideString w = v;
  return w;
}
Use Copy Initialization instead of the more direct constructor.

The underlying compiler change for the errors described above is related to the way the compiler now handles initialization and conversion.

Top

    Command Line Notes

You can now build projects from the command line using the MSBuild executable. Select Start Programs>CodeGear RAD Studio>RAD Studio Command Prompt to automatically set both the path to the MSBuild executable and the environment variable for the product.

These are the environment variables set by the RAD Studio Command Prompt for using the CodeGear RAD Studio tools, especially MSBuild:

   BDS=c:\program files\CodeGear\RAD Studio\5.0
   FrameworkDir=c:\Windows\Microsoft.NET\Framework
   FrameworkVersion=v2.0.50727

If you want to use MSBuild on the command line but are not using the RAD Studio Command Prompt, you should set these environment variables yourself.

For more information about using MSBuild, look up MSBuild in the Index or Contents of the online help.

Top

    Database Notes

    Upgrading dbExpress for Delphi 2007 for Win32

If you have been using dbExpress with Delphi 2007 for Win32, and you upgrade your copy of Delphi 2007 for Win32, you do not need to make any source code changes. However, you do need to recompile any code that uses the SQLExpr or DbxCommon units, two units that have changed since the first shipment of Delphi 2007 for Win32.

    Known Problems

  • The new MySQL dbExpress driver, dbxmys30.dll, was tested against LibMySQL.dll from a 5.0.xx server install. If you intend to use dbExpress against MySQL 4.0.xx, you should either upgrade your LibMySQL.dll to a 5.0.xx version or use the dbxmysA30.dll driver with dbExpress. Using an older version of LibMySQL.dll with the current dbExpress driver for MySQL can result in unexpected behavior.

  • An error message is displayed when trying to expand a table node from Data Explorer using LibMySQL.dll (4.x version):

    "Attempted to read or write protected memory."
    To avoid this, upgrade LibMySQL.dll to a 5.0.xx version.
  • The following combinations have been tested:

    LibMySQL.dll (4.0.XX)DBXMysA30.dllMySQL 4.0.XX Server
    LibMySQL.dll (5.0.XX)DBXMys30.dllMySQL 4.0.XX Server
    LibMySQL.dll (5.0.XX)DBXMys30.dllMySQL 4.1.XX Server
    LibMySQL.dll (5.0.XX)DBXMys30.dllMySQL 5.0.XX Server
  • If you wish to use the DBXMysA30 driver, you can both rename the DBXMys30.dll to DBXMys30.dll.bkup and DBXMysA30 to DBXMys30.dll. Alternatively, you can add a new entry to the dbxdrivers.ini file that defines DBXMysA30.dll as the LibraryName.

    New features

    dbExpress 4 Framework

Delphi database driver Framework. This is an object oriented driver Framework written in Delphi.

Delegate driver support. A delegate driver is a driver between the application and the actual driver. Delegate drivers allow for pre and post processing of all public methods and properties of the dbExpress 4 Framework. Delegate drivers are useful for connection pooling, driver profiling, tracing, and auditing. Delegate drivers are easy to implement. See the source documentation at the beginning of the DBXCommon unit for more information.

TDBXPool delegate driver. Provides connection pooling for any dbExpress driver.

TDBXTrace delegate driver. Provides enhanced tracing capability. Produces Delphi code for all traced methods and properties.

Extensible Commands. Commands that are not SQL statements or stored procedures are supported by specifying a custom "command type" property. This property is a String allowing driver and delegate driver implementers to introduce their own command type namespace of custom commands. The TDBXPool delegate driver leverages this capability to implement a "show pools" command, which returns a reader with information on the current state of all connection pools.

Source code documentation. Works with help insight for all public methods, properties, and events. XML/HTML documentation can also be generated using the --doc Delphi compiler switch.

Single source. dbExpress 4 source code can be compiled for both Win32 and .NET platforms.

dbExpress 4 source code. Full source code is provided for the dbExpress 4 Framework.

Dual interfaced drivers. All CodeGear dbExpress drivers implement the older dbExpress 3 and newer dbExpress 4 interfaces.

dbExpress 3 adapter driver. The dbxadapter30.dll DLL provides a dbExpress 4 interface for existing dbExpress 3 drivers. This allows applications to still use older non-CodeGear dbExpress 3 drivers with dbExpress 4.

Samples
  • CTS. Certification Test Suite for the dbExpress 4 Framework. This is a driver compliance test suite that also provides good examples of using the dbExpress 4 Framework directly.
  • Delegates. This demonstrates the ease of use and power of driver delegate implementations such as TDBXTrace and TDBXPool.

    Single source dbExpress VCL components

The unified code base is much easier to read, debug, and maintain.

VCL now accesses dbExpress database drivers using the new dbExpress 4 Framework.

    New database Drivers

  • InterBase 2007
  • MySQL 4.1 and 5.0

    New Unicode enabled database drivers

  • InterBase 2007
  • MySQL 4.1 and 5.0
  • Oracle
Note that Unicode support for MS-SQL was already in the product.

    Oracle dbExpress Unicode and ANSI drivers

Both Unicode and ANSI drivers ship with dbExpress. The Unicode version is dbxoraW30.dll and the ANSI version is dbxora30.dll.

    Database Change Notes

    dbExpress 2.5 not supported

dbExpress 2.5 is no longer supported in this release.

    New MySQL dbExpress driver

The new MySQL driver is called dbxmys30.dll. This driver supports Unicode strings. This driver works only with the version of MySQL's libmysql.dll for MySQL 4.1 and 5.0 servers. dbxmys30.dll does not work with older versions of libmysql.dll.

The old MySQL driver is still included in the product but has been renamed to dbxmysA30.dll. The "A" has been added to the DLL name to signify that this older driver only supports ASCII strings, not Unicode. dbxmysA30.dll can only be used with versions of MySQL's libmysql.dll that support MySQL servers version 4.0 and below.

     Delegate drivers

Two delegate drivers are provided:
  • DBXTrace
  • DBXPool

    dbExpress VCL components

Most applications are not affected by changes to the dbExpress VCL. However, there are some methods, properties, events, constants, and enums that were removed or replaced with equivalent functionality. These changes were required for these reasons:
  • Shift to using the more Delphi-like dbExpress 4 Framework instead of the more C-like COM interfaces that dbExpress 3 used.
  • Single sourcing of the dbExpress VCL components. There is now a higher level of compatibility between the native and .NET versions of the dbExpress VCL components.
Known compatibility issues:
  • The dbExpress unit is deprecated, is empty, and consequently no longer needed. Most of this unit's content has been moved to either the DBXCommon or SQLExpr units.
  • Virtually all of the classes, interfaces, enums, constants that were in the dbExpress unit have been either removed, renamed, or replaced. Renamed and replaced items can be found in the interface section of the DBXCommon or SQLExpr units.
  • Static driver libraries are no longer supported. These static libraries linked into Delphi units that allowed the native drivers to be linked into a Delphi executable file and are no longer supported. These Delphi units are: DBExpasa, DBExpDB2, DBExpInf, DBExpINT, DBExpMSS, DBExpMYS, DBExpMySQL, DBExpORA, and DBExpt.

    dbExpress application deployment for the Win32 platform

    Using packages

Project|Options|Packages must have the Build with runtime packages option checked. DbxCommonDriver100.bpl must be deployed with your application. As with prior releases, if your application uses any of the DBX*.dll dynalink dbExpress drivers, they also must be deployed.

    Unit interface compatibility

For the most part, the product maintains unit interface compatibility with BDS2006. However, the dbExpress VCL breaks this compatibility in three units: SQLExpr, DBXpress, and SQLConst. Only SQLExpr contains components. DBXpress has been deprecated. To avoid conflicts with the BDS2006 version of dbExpress100.bpl, dbExpress100.bpl has temporarily been renamed dbExpress4100.bpl. The "4" signifies that this version of the dbExpress package is for version 4 of the dbExpress drivers. When version 11.0 of the VCL ships, the normal VCL naming convention will be resumed and dbExpress4100.bpl will be renamed dbExpress110.bpl.

    Supported Servers

    dbExpress

  • InterBase 2007, 7.5.1, 7.1*, 7.0*, 6.5* (All) (Driver dbxINT30.dll, Client GDS32.DLL)
  • Adaptive Sybase Anywhere 9, 8* (Ent) (Driver dbxASA30.dll, Client dbodbc9.dll)
  • DB2 UDB 8.x, 7.x* (Ent) (Driver dbxDB230.dll, Client db2cli.dll)
  • Informix 9.x (Ent) (Driver dbxINF30.dll, Client isqlb09a.dll)
  • MSSQL 2005, 2000 (Ent) (Driver dbxMSS30.dll, Client oledb.dll)
  • MySQL 4.0.24 (All) (Driver dbxMYSA30.dll, Client libmysql.dll)
    Note: No change from dbxMYS30.dll of Delphi2006. It is renamed.
  • MySQL 5.0.27, 4.1.22* (All) (Driver dbxMYS30.dll, Client libmysql.dll)
  • Oracle 10g, 9.2.0*, 9.1.0* (Ent) (Driver dbxora30.dll, Driver dbxoraW30.dll, Client OCI.DLL)
  • Sybase 12.5 (Ent) (Driver dbxASE30.dll, Client libct.dll & libcs.dll)

* Driver not fully certified with this version of the database.

Top

    Debugger Notes

  • The linker automatically eliminates unused functions in all units when building the executable. To ensure that all functions are available to the evaluator during debugging, do the following:

    • For managed code, add an assembly reference to Borland.Delphi.dll in the Project Manager and make sure that Link Units is set to false for that reference.
    • For native code, build your application with runtime packages, so that your application requires RTL100.BPL.
  • For information about debugging ASP.NET applications that use IIS on Vista, see the ASP.NET Notes.

  • Attempting to place a data breakpoint in code might result in program corruption. For example, placing a data breakpoint on a VMT slot might result in the program jumping to an incorrect location (the "last" byte of the address is overwritten with 0xcc).
  • Installation of System Mechanic 7 Pro disables the functionality of the integrated debugger. The observed behavior is immediate termination of the process and a diagnostic message in the Event Log View. If the product is installed, debugging functionality can be restored by disabling execution of the "iolo DMV Service" via the Services manager.

Top

    Documentation Notes

  • The help viewer accessed from inside the product will always include the local help for the product. But you can choose specific other help volumes (such as MSDN Online) to be used in search and index functions. You can limit your search to local help provided by CodeGear. You can also specify that the help viewer is to either display local help first or display online help first.

    To specify the help source for the help viewer, select Tools > Options > Help > Options. Select the second option, "Try local first, then online," to enable the browser to find the proper CodeGear Help files and to display search results from the local help first, followed by results from online providers.
  • If you encounter package errors and the online help for the IDE does not work, the problem might be caused by an incomplete installation of the .NET 2.0 Framework SDK. The help viewer used by the product is part of the .NET 2.0 Framework SDK, which should be installed fully (including Product Documentation).

    To remedy this problem:
    1. Uninstall the .NET Framework SDK, located in C:\Program Files\Microsoft.NET\SDK.
    2. Uninstall the product.
    3. Reboot your system.
    4. Reinstall the product. This step also installs the .NET 2.0 Framework SDK with all the pre-requisites.

Top

    International Notes

  • Breakpoints are not recognized and are marked as "invalid" if a source file name containing non-Roman characters is placed in the project path.
  • If you are using IME (input method editor), a sporadic error caused by a .NET Framework bug might result in a long delay (approximately 5 minutes) followed by an error message. After two or three times, this error appears to stop occurring. All language windows are potentially affected.

    To avoid this error, create or update the following registry entry:

    HKEY_CURRENT_USER\Console\LoadConIme

    This entry is type REG_DWORD and you should set its value to 0.

Top

    Together Notes

  • In Delphi 2007 for Win32 and Delphi 2007 for .NET, Together supports the full set of modeling features described in the online help. In C++Builder 2007, the integrated modeling tool Together only supports read-only modeling, that is, code visualization without code generation.
  • If Together code visualization does not work for your C++ project, use the Project Manager to add the header files (.h or .hpp) to your project. This should make the information available to the Together modeling tools.
  • After removing Together support from a project, it is not possible to remove the diagram support files from the Project Manager. To remove these files, select the IDE main menu item, Project | Remove from Project. The items displayed in the list are the diagram support files. They can be multi-selected and removed.
  • If modeling support is disabled when you select Together refactorings, you see a message asking if you want to enable modeling support for the project. You must respond "Yes" to this message in order to use Together refactorings.

Top

    VCL/RTL Notes

  • Three new VCL dialogs have been added for Windows Vista:
    • TCustomFileOpenDialog
    • TCustomFileSaveDialog
    • TTaskDialog
    These components are all wrappers for Windows Vista dialogs. If the global variable UseLatestCommonDialogs is set to true, Vista dialogs are automatically used on Vista systems.
  • A new property has been added to TApplication called MainFormOnTaskBar. It defaults to True for new applications and False for existing ones. The property controls how Window's TaskBar buttons are handled by VCL. This property can be applied to older applications, but it affects the Z-order of your MainForm, so you should ensure that you have no dependencies on the old behavior. MainFormOnTaskBar is intended to be set at startup and persist throughout the duration of the application. Changing this property at runtime could result in unexpected behavior. The major reason for this change was to better support several new features available on Windows Vista.

    Creating and Installing a New Component into a New Package

Follow these steps to create a new component and install in the Tool Palette:
  1. Start RAD Studio 2007.
  2. Select File > New > Package.
  3. Select File > Save As and give your package a name.
  4. Right-click the package node and select Option from the context menu.
  5. Enter the Description for your package; the description is used in the Install Packages dialog box.
  6. Select Component > New VCL Component, which displays the New VCL Component Wizard (described later).
  7. Select TButton as the ancestor, and click Next.
  8. Accept the defaults for Classname, and so forth, and click Next.
  9. Select View> Project Manager, right-click Package1, and select Install.

To add this design-time package to an existing .PAS file that contains components, right-click the Contains node under your package and select Add.

    Installing an Existing Component into a New Package

Use the preceding steps, but at step 4 simply open the .PAS file that contains the components and add it to the Contains node of your package.

    Installing Components into an Existing Package

If you have already created and installed a design-time package, use the following steps to add a new component:
  1. Select Component > Install Packages.
  2. Find the desired package and select it in the Design Packages listbox.
  3. Click the Edit button which will prompt you to cancel the dialog and open the package as a project.
  4. Select View > Project Manager.
  5. Expand the package node, right-click the Contains node under the package, and select Add.
  6. Add your existing .PAS file or select Component > New VCL Component and follow the steps in the previous Creating and Installing procedure.
  7. Right-click the package node in the Project Manager and select Compile. This will rebuild and reinstall your design-time package.

    Installing Existing Design-Time Packages

If you have existing component packages you want to install on the palette, use the following steps:
  1. Select Component > Install Packages.
  2. Click Add and multi-select the design-time packages you want to install.
  3. Click OK.

    Using the New VCL Component Wizard

The New VCL Component Wizard places both design-time and runtime code into a single unit. The runtime code is the code that implements the component itself. The design-time code is the Register procedure with the call to RegisterComponents which should be removed and placed in a different unit which belongs in a design time package.

In the first scenario above, it would be wise to create a second, design-time only package and split the code as described. Additionally, you should mark your packages explicitly as design-time and runtime using Usage Options from the Project Options dialog box. Mixing design-time and runtime code in a single package is a bad idea and needs to be avoided. Design-time code isn't necessary at runtime and typically contains property and/or component editors along with various registration calls that are only meaningful when the package is installed in the IDE.

Top

    SOAP Server

The default Delphi SOAP Server application with Web App Debugger class does not compile. There are two possible workarounds:

  • Include $(BDS)\Lib\Indy9 in the Library path and remove $(BDS)\Lib\Indy10. However, this means your application must use Indy 9.
  • Compile IndySockTransport and sockapp and put it in $(BDS)\Lib\Indy10.

Top

Copyright 2007 CodeGear Software. All rights reserved.




Server Response from: ETNASC03