Syntax
__declspec(<decl-modifier>)
Description
The decl-modifier argument can be delphiclass or pascalimplementation. These arguments should be used only with classes derived from VCL classes.
- You must use __declspec(delphiclass) for any forward declaration of classes that are directly or indirectly derived from TObject.
- Use the __declspec(pascalimplementation) modifier to indicate that a class has been implemented in the Delphi language. This modifier appears in a Delphi portability header file with a .hpp extension.
Note: Another argument, delphireturn
, is used internally to mark C++ classes for VCL-compatible handling in function calls as parameters and return values. The
delphiclass argument is used to create classes that have the following VCL compatibility.
- VCL-compatible RTTI
- VCL-compatible constructor/destructor behavior
- VCL-compatible exception handling
A VCL-compatible class has the following restrictions.
- No virtual base classes or multiple inheritance is allowed.
- Must be dynamically allocated by using the global new operator.
- Copy and assignment constructors must be explicitly defined. The compiler does not automatically provide these constructors for VCL-derived classes.
- Must publicly inherit from another VCL class.