I may be misunderstanding the use of
Variant.PtrValue so can somebody please explain what’s going on here?
This code hard crashes:
Var v As Variant = 5 Var i As Integer = v.PtrValue.Integer
And this code raises a
TypeMismatchException (with no explanation for the exception in the debugger):
Var v As Variant = DateTime.Now Var i As Integer = v.PtrValue.Integer
What I’m trying to do is get the actual memory address of a variant. Why? I’m trying to use it as a substitute for create a unique hash code for objects in my physics engine and I figured that using the actual memory location would be unique within a running app.
Is there anyway to get the memory address of a variable at runtime?