Article

From:
To:
All
Subject:
Porting Delphi2006 component to C++Builder2006
Newsgroup:
embarcadero.public.cppbuilder.vcl.components.writing

Porting Delphi2006 component to C++Builder2006

Hi,

I need port component in Delphi2006 to C++Builder2006. In this case,
the Freeimage library (open source) need to be integrated via a run-time package for use
in others components.
I try to rebuild the package in C++Builder (transforming the lib with the utility Coff2Omf).
But the linker shows many times the same error type :
[Linker Error] Error: Unresolved external '_FreeImage_GetFileType@8' referenced from
C:\xxx\DEBUG_BUILD\FREEUTILS.OBJ
.....
[Linker Error] Error: Unresolved external '_FreeImage_ConvertTo16Bits555@4' referenced from
C:\xxx\DEBUG_BUILD\FREEBITMAP.OBJ
.....

The package project "contains" the FreeImage.lib. The FREEUTILS.pas and the FREEBITMAP.pas files reference a third file (there is only three files in the package) FreeImage.pas (I have renamed it to FreeImageUnit.pas to avoid conflict with the Freeimage.lib when adding it to the package project). In this last unit FreeImage(Unit).pas, all the definitions are done:

const
  FIDLL = 'FreeImage.dll';
.....
function FreeImage_GetFileType(const filename: PChar; size: Integer): FREE_IMAGE_FORMAT;
   stdcall; external FIDLL name '_FreeImage_GetFileType@8';
function FreeImage_GetFileTypeU(const filename: PWideChar; size: Integer): FREE_IMAGE_FORMAT;
   stdcall; external FIDLL name '_FreeImage_GetFileTypeU@8';
....

Each function in the two others units (FreeUtils and FreeBitmap) do calls in the FreeUtils(Unit).pas
that itself map each function in the dll using External keyword.

There is certainly a thing that I forget but which ? It appears that the linker cannot do the join between the lib/dll and declaration in the pas units. Redeclaring the external in the FreeUtils
doesn't change anything. (In D2006, it works perfectly)

Some idea is wellcom...
Thanks Eddy Poullet Brussels
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Thu, 28 Mar 2024 14:12:08 UTC
Copyright © 2009-2024
HREF Tools Corp.