#1 2011-12-06 16:26:13

hugh
Member
From: Canada
Registered: 2011-12-06
Posts: 8

Problem Compiling with Delphi 2007 for Win32 Pro

Hi,

I posted some comments here with a similar problem with mORMot.

I received the following errors while trying to compile synPDF:

[DCC Warning] synpdf_proj.dpk(41): W1029 Duplicate constructor 'TZipWrite.CreateFrom' with identical parameters will be inacessible from C++
[DCC Warning] synpdf_proj.dpk(41): W1032 Exported package threadvar 'SynCommons.SynLogFileIndex' cannot be used outside of this package
[DCC Error] E2201 Need imported data reference ($G) to access 'VarCopyProc' from unit 'SynCommons'
[DCC Warning] W1029 Duplicate constructor 'TZipWrite.CreateFrom' with identical parameters will be inacessible from C++

I found this note on the embarcadero forum that describes one of the warnings:

An object file is being generated and Two, differently named, constructors or destructors with identical parameter lists have been created; they will be inaccessible if the code is translated to an HPP file because constructor and destructor names are converted to the class name. In C++ these duplicate declarations will appear to be the same function.

I fixed the following warnings by changing the signature of this CreateFrom constructor to include a default integer parameter that does nothing.

[DCC Warning] synpdf_proj.dpk(41): W1029 Duplicate constructor 'TZipWrite.CreateFrom' with identical parameters will be inacessible from C++
[DCC Warning] W1029 Duplicate constructor 'TZipWrite.CreateFrom' with identical parameters will be inacessible from C++


constructor CreateFrom(const aFileName: TFileName; param:integer=0);

Last edited by hugh (2011-12-06 21:26:06)

Offline

#2 2011-12-06 17:03:31

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

Re: Problem Compiling with Delphi 2007 for Win32 Pro

Is this Warning failing the compilation?

Offline

#3 2011-12-06 21:24:19

hugh
Member
From: Canada
Registered: 2011-12-06
Posts: 8

Re: Problem Compiling with Delphi 2007 for Win32 Pro

There there are warnings and an Error.  The error is failing compilation.   I was just trying to also clean up the warnings so I posted a hack to fix the problem.

The error is [DCC Error] E2201 Need imported data reference ($G) to access 'VarCopyProc' from unit 'SynCommons',

I tried to include {$IMPORTEDDATA ON} and {$G+}in the .inc file but it didn't make a difference.

Last edited by hugh (2011-12-06 21:32:06)

Offline

#4 2011-12-08 15:19:40

hugh
Member
From: Canada
Registered: 2011-12-06
Posts: 8

Re: Problem Compiling with Delphi 2007 for Win32 Pro

I did some more poking around and the problem seems to be that I want to add the synpdf source files to its own package.  Here is the package source that I have:

package synpdf_proj;

{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS OFF}
{$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}
{$DESCRIPTION 'SynPDF'}
{$RUNONLY}
{$IMPLICITBUILD OFF}

requires
  rtl,
  vcl;

contains
  SynZip in 'SynZip.pas',
  SQLite3Pages in 'SQLite3Pages.pas',
  SynCommons in 'SynCommons.pas',
  SynGdiPlus in 'SynGdiPlus.pas',
  SynLZ in 'SynLZ.pas',
  SynPdf in 'SynPdf.pas';
end.

Any ideas how I can work around the above error?

I've added the source directly to my application project and it seems to compile without error but I would like to use in a couple of applications so it would make more sense to create a package.

Offline

#5 2011-12-08 15:21:55

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

Re: Problem Compiling with Delphi 2007 for Win32 Pro

Did you try to add the Variants unit to your package?

Offline

#6 2011-12-08 19:52:51

hugh
Member
From: Canada
Registered: 2011-12-06
Posts: 8

Re: Problem Compiling with Delphi 2007 for Win32 Pro

Do I need to do that explicitly?  The Variants is in the uses clause for the SynCommons.pas file.

I'm not sure how I would add the Variants unit to the project file itself.

Offline

#7 2011-12-09 06:35:14

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

Re: Problem Compiling with Delphi 2007 for Win32 Pro

I guess this is a known issue in the Delphi linker about packages.

See https://forums.embarcadero.com/message. … ageID=6844

It appears that asm functions (like the standard VarCopyProc).

If you add the PUREPASCAL conditional to your package options, I think you'll get rid of this problem.

I've added a specific conditional define named USEPACKAGES which would do it more efficiently.
See http://synopse.info/fossil/info/7a843d95e8

Offline

#8 2011-12-09 14:54:54

hugh
Member
From: Canada
Registered: 2011-12-06
Posts: 8

Re: Problem Compiling with Delphi 2007 for Win32 Pro

That works!  I just uncommented the {.$define PUREPASCAL} already defined in synopse.inc.

Thanks

Offline

Board footer

Powered by FluxBB