Xiangrong Fang wrote:
However, like in my first mail, if I define THandler a procedure of object, it makes easier to SetHandler(AMethod); but how can I use that "procedure of object" pointer in the so?

It works the same, cast the data you receive to a TMethod and call the "code" member with the appropriate parameters. So, in the "C" library do this:

typedef struct
{
  Data: Pointer;
  Code: Pointer;
}TMethod;

void SetHandler(TMethod h);
{
  StoredH = h;
}

typedef void (*TDataHandler)(void* Self, void* Data);

void DoSomething();
{
  ((TDataHandler)(StoredH.Code))(StoredH.Data, SomeData);
}

Warning, this is pseudo code, you should adapt it so that it can compile.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to