#1 2015-01-03 18:56:17

wloochacz
Member
Registered: 2015-01-03
Posts: 45

SynCommons.pas - delphi package compilation error. Again :(

If you try to create a package for the mORMot:
[DCC Error] SynCommons.pas(1): E2234 Getter or setter for property 'Count' cannot be found

I'm using the latest NightlyBuild revision:
http://synopse.info/files/mORMotNightlyBuild.zip

Of course i'm defined the USEPACKAGES conditional in my project options.

My package source:

package Package1;

{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$IMPLICITBUILD ON}
{$DEFINE USEPACKAGES}

requires
  rtl;

contains
  HTTPDB.Server in 'HTTPDB.Server.pas';

end.

My unit code:

unit HTTPDB.Server;

interface

uses
  SynDBVCL,
  SynDB,
  SynDBDataset,
  SynDBFireDAC,
  SynDBRemote,
  SynVirtualDataset,
  SynCommons;

type
  THttpDbServer = class
  strict private
    FDBConnectionProp: TSQLDBConnectionProperties;
    FHttpServer      : TSQLDBServerHttpApi;

    function GetDBConnectionProp: TSQLDBConnectionProperties;
    function GetHttpServer      : TSQLDBServerHttpApi;
  public
    procedure BeforeDestruction; override;
    property DBConnectionProp: TSQLDBConnectionProperties read GetDBConnectionProp;
    property HttpServer      : TSQLDBServerHttpApi        read GetHttpServer;
  end;

implementation

uses
  uADPhysIB;

procedure THttpDbServer.BeforeDestruction;
begin
  inherited;
  FHttpServer.Free;
  FDBConnectionProp.Free;
end;

function THttpDbServer.GetDBConnectionProp: TSQLDBConnectionProperties;
begin
  if not Assigned(FDBConnectionProp) then
    FDBConnectionProp := TSQLDBFireDACConnectionProperties.Create('IB?CharacterSet=WIN1250', '127.0.0.1:C:\NX\DATA.FDB', 'SYSDBA', 'masterkey');

  Result := FDBConnectionProp;
end;

function THttpDbServer.GetHttpServer: TSQLDBServerHttpApi;
begin
  if not Assigned(FHttpServer) then
    FHttpServer := TSQLDBServerHttpApi.Create(DBConnectionProp, 'FB', '8092', 'user', 'pass');

  Result := FHttpServer;
end;

end.

Thank you for your help! smile

Offline

#2 2015-01-03 20:39:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: SynCommons.pas - delphi package compilation error. Again :(

Your code won't compile as such (the override in THttpDBServer).
There is a missing parent class, obviously.

I tried to create a package containing SynCOMmons.pas, SynDB.pas and mORMot.
No problem with Delphi 7 and Delphi XE7.

Which version of the compiler are you using?
What if you put just SynCommons in your package?
Did you know what object/class this "count" is member of?
Try to disable HASINLINE conditional in Synopse.inc.

Online

#3 2015-01-04 17:08:17

wloochacz
Member
Registered: 2015-01-03
Posts: 45

Re: SynCommons.pas - delphi package compilation error. Again :(

ab wrote:

Your code won't compile as such (the override in THttpDBServer).
There is a missing parent class, obviously.

I don't think so ;-)
Please check yourself, here you can download the package:
http://www.dflex.pl/dflex-ftp/mORMot_Package.zip

ab wrote:

I tried to create a package containing SynCOMmons.pas, SynDB.pas and mORMot.
No problem with Delphi 7 and Delphi XE7.

Strange...

ab wrote:

Which version of the compiler are you using?

Delphi XE Pro

ab wrote:

What if you put just SynCommons in your package?

No changes...

ab wrote:

Did you know what object/class this "count" is member of?

Unfortunately, no.
Delphi raise error with SynCommons.pas(1)
What is total bull...t, because the first line of the SynCommons.pas does not have any error...

ab wrote:

Try to disable HASINLINE conditional in Synopse.inc.

Unfortunately, then exactly the same error.

Last edited by wloochacz (2015-01-04 17:09:00)

Offline

#4 2015-01-04 18:47:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: SynCommons.pas - delphi package compilation error. Again :(

I have no problem to compile your package with Delphi XE7.

My IDE added the following references:

requires
  rtl,
  vcl,
  dbrtl,
  FireDACCommon,
  FireDACCommonDriver,
  FireDAC;

Online

#5 2015-01-04 19:39:33

wloochacz
Member
Registered: 2015-01-03
Posts: 45

Re: SynCommons.pas - delphi package compilation error. Again :(

ab wrote:

I have no problem to compile your package with Delphi XE7.

My IDE added the following references:

requires
  rtl,
  vcl,
  dbrtl,
  FireDACCommon,
  FireDACCommonDriver,
  FireDAC;

... and implicity import all mORMmot units. That's normal.
OK, but package not working in Delphi XE.
Please, any idea?

Offline

#6 2015-01-04 21:37:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: SynCommons.pas - delphi package compilation error. Again :(

Xe only bug?

Online

#7 2015-01-04 22:03:00

miab3
Member
From: Poland
Registered: 2014-10-01
Posts: 188

Re: SynCommons.pas - delphi package compilation error. Again :(

@wloochacz, @ab,

In my Delphi XE2-32 it looks so:

requires
  rtl,
  vcl,
  xmlrtl,
  dbrtl,
  AnyDAC_Phys_D16,
  AnyDAC_ComI_D16,
  AnyDAC_PhysIB_D16,
  AnyDAC_Comp_D16;

and it works.

Michal

Offline

#8 2015-01-05 14:21:17

wloochacz
Member
Registered: 2015-01-03
Posts: 45

Re: SynCommons.pas - delphi package compilation error. Again :(

Maybe XE bug - i don't know...
But, there is workaround (SynCommons.pas):

class TSynCache
property property Count: integer read fNameValue.Count;

I changed to:

property Count: integer read GetCount;

Where GetCount is:

function TSynCache.GetCount: integer;
begin
  Result := fNameValue.Count;
end;

And now i'ts working!
Arnaud can you confirm this?

Offline

#9 2015-01-05 19:01:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: SynCommons.pas - delphi package compilation error. Again :(

Should be fixed by http://synopse.info/fossil/info/f89f7d899

Thanks a lot for finding out the root cause!
Circumventing all limitations/issues of all Delphi compilers is really a nightmare, and very time consuming!
Thanks again

Online

#10 2015-01-05 19:49:40

wloochacz
Member
Registered: 2015-01-03
Posts: 45

Re: SynCommons.pas - delphi package compilation error. Again :(

ab wrote:

Now is OK!

ab wrote:

Thanks a lot for finding out the root cause!
Circumventing all limitations/issues of all Delphi compilers is really a nightmare, and very time consuming!
Thanks again

No, no - I thank you very much!

PS.
Now only remains to implement interface-based callbacks and will be great! ;-)

Offline

#11 2016-05-28 23:30:26

Piopio
Member
Registered: 2014-11-15
Posts: 6

Re: SynCommons.pas - delphi package compilation error. Again :(

Hello

I downloaded SynPDF a few days ago and the same problem is still there.
I have followed the instructions, modified code and now it works perfectly.

Alberto

Offline

#12 2016-05-29 07:07:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: SynCommons.pas - delphi package compilation error. Again :(

Which version did you download?

Latest version is 1.18.2697.

Online

#13 2016-08-16 21:30:40

Piopio
Member
Registered: 2014-11-15
Posts: 6

Re: SynCommons.pas - delphi package compilation error. Again :(

I just download again the version here http://synopse.info/fossil/wiki?name=PDF+Engine and here https://github.com/synopse/SynPDF. The sources are slightly different but they have the same issue on XE2.

I solved the issue by changing the following source

{$ifdef VER220} { circumvent Delphi XE compilation with packages }
function Count: integer;
{$else}
property Count: integer read fNameValue.Count;
{$endif}

into

{$ifdef VER220} { circumvent Delphi XE compilation with packages }
function Count: integer;
{$else}
property Count: integer read GetCount;
{$endif}

and by adding

function TSynCache.GetCount:Integer;
begin
  Result := fNameValue.Count;
end;

This way I can compile

Offline

#14 2016-08-17 12:27:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,656
Website

Re: SynCommons.pas - delphi package compilation error. Again :(

Online

Board footer

Powered by FluxBB