I have function (written in Delphi 7, 32-bit):
Function GetVMTAddr(var C): Integer;
Begin
Result := Integer(C);
Try
PVmt(Result)^.SelfPtr := PVmt(C)^.SelfPtr;
Except
Result := 0;
End;
End;
Which returns VMT Address (I think it is VMT, I'm not sure) and checks if parameter is an object (by try...except, which is imho poor solution).
I have two questions:
1) Is this really VMT address or I'm wrong?
2) Is there any better solution to check that parameter is an object?