I want to store the pointer of a method inside a longword, like this:

type
TMyMethod = procedure of object;

var
Storage: LongWord;

begin
Storage := LongWord(@AnObject.ItsMethod);
..

Later I want to retrieve it like this:

var
Method: TMyMethod;

begin
LongWord(@Method) := Storage;

I have tested a code like this, and the method is called. The problem is that Self = nil. I suppose Delphi stores more than just the pointer to the method, it should also store the corresponding Self. How can I store both pointers in a type which is not TMyMethod, and how can I call the function to let it know which Self it should use? :?