Using the TCustomVariantType Descendant
Go Up to Copying and Clearing Custom Variants
In the initialization section of the unit that defines your TCustomVariantType descendant, create an instance of your class. When you instantiate your object, it automatically registers itself with the variant-handling system so that the new Variant type is enabled. For example, here is the initialization section of the VarCmplx unit:
Delphi:
initialization
ComplexVariantType := TComplexVariantType.Create;
In the finalization section of the unit that defines your TCustomVariantType
descendant, free the instance of your class. This automatically unregisters the variant type. Here is the finalization section of the VarCmplx unit:
Delphi:
finalization
FreeAndNil(ComplexVariantType);