#1 2012-07-10 18:50:10

rodrigofarias77
Member
Registered: 2012-02-07
Posts: 6

Warning in Delphi 2007

Hello,

I get this warning when I compile synpdf with Delphi 2007:

synpdf_proj.dpk(43) Warning: W1032 Exported package threadvar 'SynCommons.SynLogFileIndex' cannot be used outside of this package

Other than setting to DCC_PACKAGED_THREADVAR false in the .dproj file, do you guys any alternative to get rid of this warning?

Is it safe to ignore "SynLogFileIndex: TSynLogFileIndex" and maybe "CurrentHandleExceptionSynLog: TSynLog" in SynCommons.pas?

Thanks,

Rod

Offline

#2 2012-07-11 05:17:04

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

Re: Warning in Delphi 2007

We have moved logging threadvars and associated structures into hidden internal declaration, for better work with packages (avoid W1032 warning).
See http://synopse.info/fossil/info/1080b93549

Using threadvar within a package is safe by definition.
But exporting them is not supported by windows.

Delphi Doc wrote:

Windows does not support the exporting of threadvar variables from a DLL, but since using packages is meant to be semantically equivalent to compiling a project without them, the Delphi compiler must somehow attempt to support this construct.
This warning is to notify you that you have included a unit which contains a threadvar in an interface into a package. While this is not illegal, you will not be able to access the variable from a unit outside the package.
Attempting to access this variable may appear to succeed, but it actually did not.
A solution to this warning is to move the threadvar to the implementation section and provide function which will retrieve the variables value.

See http://docwiki.embarcadero.com/RADStudio/en/W1032_Exported_package_threadvar_'%25s.%25s'_cannot_be_used_outside_of_this_package_(Delphi)

Thanks for the feedback!

Offline

#3 2012-07-11 16:24:58

rodrigofarias77
Member
Registered: 2012-02-07
Posts: 6

Re: Warning in Delphi 2007

Thanks for replying ab. Will try the latest version of your code.

Rod

Offline

Board footer

Powered by FluxBB