March 2000
Intermediate to advanced
576 pages
18h 13m
English
RefAnyProc Variable
var RefAnyProc: Pointer; procedureRefAny(var V: Variant); RefAnyProc := @RefAny;
The RefAnyProc variable points to a procedure that
creates a reference to a varAny
Variant. If you must maintain a reference count,
RefAny increments the reference count. If each
varAny keeps a unique copy, you can make a copy of
the varAny data in the
RefAnyProc procedure. The default value is a
procedure that raises runtime error 15
(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.
// Each varAny Int64 value has its own unique Int64 value.
// When Delphi makes a reference, it sets V to a copy of
// the original. This procedure gives V a unique Int64 value.
procedure RefVarInt64(var V: Variant);
var
Value: Int64;
begin
if TVarData(V).VType = varAny then
begin
Value := PInt64(TVarData(V).VAny)^;
SetVarInt64(V, Value);
end;
end;
...
RefAnyProc := @RefVarInt64;| ChangeAnyProc Variable, ClearAnyProc Variable, TVarData Type, Variant Type |
Read now
Unlock full access