ClearAnyProc Variable
When Delphi is finished using a
varAny
Variant
value, it calls
ClearAnyProc
to free all memory associated with
the opaque varAny
value. The default value is a
procedure that raises runtime error 16
(EVariantError
).
The CorbaObj
unit sets this variable to point to a
procedure that supports CORBA’s Any type. If you are not using
CORBA, you can use varAny
values for your own
purposes.
See the ChangeAnyProc
variable for an explanation
of this example.
// Clear a varAny Variant that is holding a pointer to an Int64 value.
procedure ClearVarInt64(var V: Variant);
var
Ptr: Pointer;
begin
if TVarData(V).VType = varAny then
begin
Ptr := TVarData(V).VAny;
TVarData(V).VType := varEmpty;
FreeMem(Ptr);
end;
end;
...
ClearAnyProc := @ClearVarInt64;