HomeDelphiDelphi Error – W1032 Exported package threadvar ‘%s.%s’ cannot be used outside of this package

Delphi Error – W1032 Exported package threadvar ‘%s.%s’ cannot be used outside of this package

Delphi Compiler Error

W1032 Exported package threadvar ‘%s.%s’ cannot be used outside of this package

Reason for the Error & Solution

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.

Share:

Leave a Reply

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...