Show: Delphi C++
Display Preferences

__declspec(delphirecord)

From RAD Studio
Jump to: navigation, search

Go Up to Keywords, Alphabetical Listing Index


Category

Modifiers (C++), Keyword Extensions, Storage Class Specifiers (C++)

Syntax

__declspec( delphirecord ) declarator

The delphirecord storage class attribute is used when converting Delphi records into C++ classes/structs in .hpp headers (using dcc32 -JPHNE <filename.pas>). In Delphi there is a convention regarding records being returned from functions, which states that a function returning a record will return a hidden parameter pointing to the record to be returned. Delphi returns a pointer to a location that is zero initialized, whereas C++ does not offer such a guarantee. For compliance, when C++ finds a struct that is being returned from a function and is flagged as __declspec(delphirecord), it will zero out the memory location.

Note: There is one particular case when a user may want to declare a struct __declspec(delphirecord) explicitly: for a record originally declared in Delphi that has either the {$EXTERNALSYM} or the {$NODEFINE} directive.

See also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance