Page 1 of 1

ilink64 error with ZeosLib

Posted: Mon Jul 23, 2018 6:37 pm
by macicogna
Hi All,

I'm trying to compile ZeosLib version 7.2.4 (Stable) with C++Builder 10.2.3 Tokyo for target platform Win64.

I'm able to compile and test the packages for Win32, but I got a ilink64 error with Win64 :

Code: Select all

[ilink64 Error] Error: Unresolved external 'Zmessages::STokenizerIsNotDefined' referenced from C:\USERS\MACIC\BCBCOMPNEW\ZEOSLIB\PACKAGES\CBUILDERXE102\WIN64\RELEASE\LIB\ZSCRIPTPARSER.O
The first package, ZCore250.bpl just requires rtl.bpi and the second package, ZParseSql250.bpl, requires rtl.bpi and ZCore.bpi.

The package ZCore250.bpl contains a unit called ZMessages.pas and the problematic STokenizerIsNotDefined are declared and defined like this:

Code: Select all

unit ZMessages;

interface

{$I ZCore.inc}

uses ZCompatibility;

procedure loadmessages();

const
//...

resourcestring
//...
  cSTokenizerIsNotDefined = 'l''objet Tokenizer n''est pas défini';
//...
  cSTokenizerIsNotDefined = 'Tokenizer is not defined';

var
//...
  STokenizerIsNotDefined: String;
//...
implementation

procedure loadmessages;
begin
//...
  STokenizerIsNotDefined := cSTokenizerIsNotDefined;


Checking the ilink64 command, I can confirm that the .o location is right:

Code: Select all

ilink64 command line
  c:\program files (x86)\embarcadero\studio\19.0\bin\ilink64.exe -G8 

-LC:\Users\macic\BCBCompNew\ZeosLib\packages\CBuilderXE102\Win64\Release\Lib;
Could be a problem, or any kind of project configuration with the 64bit compiler and linker dealing with this ZMessages.pas code?

Any help or hint is appreciated.

Regards,

Marcelo.

Re: ilink64 error with ZeosLib

Posted: Wed Sep 25, 2019 2:40 pm
by macicogna
Hello All,

I've just found a solution to this and I would like to share with you.

My start point was Malcolm Smith's article "64-Bit Packages in C++Builder" (BCBJ Vol. 18, Number 4 - April 2014).

Besides Malcolm's hints about <AllPackageLibs> and *.lib files, these troubleshoot did not work with C++Builder 10.2.3. Also, I was intrigued because Win64 compiler generates *.bpi files, but not *.lib. It generates *.a files.

I don't have a whole picture how it workds, but it seems that dynamic linking needs static libs to achieve its goal.
  • In Win32 [.lib] + [.bpi] -> [.bpl].
  • In Win64 [.a] + [.bpi] -> [.bpl].
Following another thread in "https://forums.embarcadero.com/message. ... eID=651274", I've got these packages working after applying this suggestion:
Workaround was adding Win64 library file "Test1.a" to Test2.cbproj (Add file to project)
Success!

With C++Builder 10.2.3 and Win34 platform, we need to add "Dynamic library import files (*.a)" in Package's Contains list !!!

The IDE will include <LibFiles Include=something.a> nodes in .cbproj files. It is like what we usually do with .lib files when got ilinker32 errors and I think it is related with Malcolm's article.

Now ZeosDBO packages are working with Win64. Test App with ZeosDBO also working as a 64bit application.

I hope this might help other with problems about Packages, PAS files and Win64 platform with C++Builder.

Regards,

Marcelo.
P.S. BCB Journal's writers and editors, I miss you a lot!