#1 2013-03-15 09:39:44

marvel
Member
Registered: 2013-03-15
Posts: 2

Fails to compile in 64-bit Delphi XE2 and XE3

This simple test I collect in this forum fails to compile:

var
 lPdf   : TPdfDocument;
 lPage  : TPdfPage;
begin
  lPdf := TPdfDocument.Create;
  try
    lPdf.Info.Author        := 'Tester';
    lPdf.Info.CreationDate  := Now;
    lPdf.Info.Creator       := 'Tester';
    lPdf.DefaultPaperSize   := psA4;
    lPage := lPDF.AddPage;
    lPDF.Canvas.SetFont('Helvetica',10.0,[]);
    lPDF.Canvas.SetLeading(lPDF.Canvas.Page.FontSize);
    lPDF.Canvas.SetLineWidth(0.1);

    lPdf.Canvas.BeginText;
    lPdf.Canvas.TextOut( 300, 700,  'This is some text.');
    lPdf.Canvas.EndText;
    lPdf.SaveToFile(extractfilepath(application.exename)+'test.pdf');
  finally
    lPdf.Free;
  end;

I tracked the issue to 3 problem areas and was able to fix it (at least for the above sample) as follows:

1) In SynCommons.pas move this to the beginning of the Implementation section:

var
  SynLogExceptionEnabled: Boolean = false;

type
  /// an array to all available per-thread TSynLogFile instances
  TSynLogFileIndex = array [0 .. MAX_SYNLOGFAMILY] of integer;

var
  /// internal list of created TSynLog instance, one per each log file on disk
  // - do not use directly - necessary for inlining TSynLogFamily.SynLog method
  SynLogFile: TObjectList = nil;

  threadvar
  /// each thread can access to its own TSynLogFile
  // - TSynLogFile instance is SynLogFile[SynLogFileIndex[TSynLogFamily.Ident]-1]
    SynLogFileIndex: TSynLogFileIndex;
  /// used internaly by function GetHandleExceptionSynLog

  CurrentHandleExceptionSynLog: TSynLog;
  { ************ some fast UTF-8 / Unicode / Ansi conversion routines }

2) In SynCommons.pas, Initialization section replace Assert(SizeOf(TSynTableData) = 16); with

 {$ifdef CPU64}
         Assert(SizeOf(TSynTableData) = 24);
 {$else}
        Assert(SizeOf(TSynTableData) = 16);
{$endif}

3) In SynCommons.pas and SynGDIPlus.pas
Remove packed from every instance of 64-bit compilation, for example do as follows:

TVarData {$ifdef CPU64} record {$else} packed record {$endif}

This will make it compile (AND run well) in 64-bit.

Marvel

Last edited by marvel (2013-03-15 09:42:53)

Offline

#2 2013-03-15 10:00:38

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

Re: Fails to compile in 64-bit Delphi XE2 and XE3

You may have save you some time... all those modifications are not necessary.
Seems that you are using an older version of the library (the one shipped as archive).
Before trying to fix something, please check the latest revision.

If you use the latest 1.18 version from http://synopse.info/fossil/wiki?name=Get+the+source it will directly compiles and run with Win32 and Win64 platforms.
We made a full code review and testing phase for 64 bit support.
All mORMot units compiles and run fine in Win64 in the unstable/trunk branch.

Thanks for the feedback!

Offline

#3 2013-03-15 10:32:02

marvel
Member
Registered: 2013-03-15
Posts: 2

Re: Fails to compile in 64-bit Delphi XE2 and XE3

ab wrote:

You may have save you some time... all those modifications are not necessary.


Thanks for the feedback!

Thanks, I will have a look. What I had was the "Latest stable version is available directly from in SynPdf.zip"

Marvel

Offline

#4 2013-03-15 10:45:21

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

Re: Fails to compile in 64-bit Delphi XE2 and XE3

Yes... this was the "stable" version.

In our units, the "unstable" version is mostly preferred.
Due to our automated regression tests, the latest version... the best...
smile

Offline

Board footer

Powered by FluxBB