RAD Studio (Common)
ContentsIndex
PreviousUpNext
x1008: Integer and HRESULT interchanged (Delphi)

In Delphi, Integer, Longint, and HRESULT are compatible types, but in C++ the types are not compatible and will produce differently mangled C++ parameter names. To ensure that there will not be problems linking object files created with the Delphi compiler this message alerts you to possible problems. If you are compiling your source to an object file, this is an error. Otherwise, it is a warning.

program Produce;
  uses Windows;

  type
    I0 = interface (IUnknown)
      procedure p0(var x : Integer);
    end;

    C0 = class (TInterfacedObject, I0)
      procedure p0(var x : HRESULT);
    end;

  procedure C0.p0(var x : HRESULT);
  begin
  end;

begin
end.

The example shown here declares the interface and class methods differently. While they are equivalent in Delphi, they are not so in C++.

program Solve;

  uses Windows;

  type
    I0 = interface (IUnknown)
      procedure p0(var x : Integer);
    end;

    C0 = class (TInterfacedObject, I0)
      procedure p0(var x : Integer);
    end;

  procedure C0.p0(var x : Integer);
  begin
  end;

begin
end.

The easiest solution to this problem is to match the class-declared methods to be identical to the interface-declared methods.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!