March 2000
Intermediate to advanced
576 pages
18h 13m
English
ClearAnyProc Variable
var ClearAnyProc: Pointer; procedureClearAny(var V: Variant); ClearAnyProc := @ClearAny;
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;| ChangeAnyProc Variable, RefAnyProc Variable, TVarData Type, Variant Type |
Read now
Unlock full access