Does anyone know of a generic version of (System.Classes.)MakeObjectInstance that will take a generic method type (as in ) of just a plain TMethod? Is a generic (as in ) version is possible?

Comments

  1. Mahdi Safsafi From reading the source, that is what I want! Not quite how I was going to attempt to do it - yours is way better! :-D

    Will this become apart of DDL? I hope it does.

    ReplyDelete
  2. Nicholas Ring I just found a way to pass the object instance.
    Now it's possible to write something like this:

    procedure TMyObjHook.DoxHooked(const S: String;A,B,C:Integer; Obj: TObject);
    begin
    {First Hidden Param = Self.}
    {Last Param Obj = TMyObj Instance.}
    //Obj.ClassName = TMyObj;
    Trampoline(S,A,B,C,Obj);
    end;
    Isn't better than : 
    procedure TMyObjHook.DoxHooked(const S: String;A,B,C:Integer);
    begin
    Trampoline(S,A,B,C,Main.FMyObj); 
    end;
    ?

    I know , the new MakeObjInstance implementation is out of what it should do.But i think it's very nice to access the object instance from function arguments rather than X.Obj.
    My code is still limited,and need extra hard works.

    I don't mind to integrate with DDL,but i really don't know if it would be useful since we can hook without this way.

    ReplyDelete
  3. Mahdi Safsafi Neat. Should I ask what the magic is? Need a tester? ;-)

    I think you should add your MakeObject to DDL - not within DDetours.pas it self but as an external unit that people can bring in if they like...

    ReplyDelete

Post a Comment