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
On 10 Mar 2015, at 10:40, OBones wrote:
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
On 03/09/2015 04:20 PM, Xiangrong Fang wrote:
can I implement SetHandler in a library written in C, then call h in C?
For inter-language calls you obviously need to to define the calling
style on both sites. e.g. STDCALL or PASCAL, to make both use
compatible calling conventions.
I don't
Hi all,
I define a procedure like this:
type
TDataHandler = procedure(data: Pointer) of object;
procedure SetHandler(h: TDataHandler); external cdecl;
Now, can I implement SetHandler in a library written in C, then call h in C?
Thankyou.
--
Sent from Gmail Mobile
On 09 Mar 2015, at 18:43, Michael Van Canneyt wrote:
You must be sure that self is passed in the correct register.
I am not sure this is the case if you declare it as an extra argument.
It is, as long as the `self` is the first parameter. Same goes for `Class
Procedure XXX;` kind of
On Mon, 9 Mar 2015, OBones wrote:
Michael Van Canneyt wrote:
On Mon, 9 Mar 2015, Xiangrong Fang wrote:
Hi all,
I define a procedure like this:
type
TDataHandler = procedure(data: Pointer) of object;
procedure SetHandler(h: TDataHandler); external cdecl;
Now, can I implement
On Mon, 9 Mar 2015, Xiangrong Fang wrote:
Hi all,
I define a procedure like this:
type
TDataHandler = procedure(data: Pointer) of object;
procedure SetHandler(h: TDataHandler); external cdecl;
Now, can I implement SetHandler in a library written in C, then call h in C?
IMHO Not without
Michael Van Canneyt wrote:
On Mon, 9 Mar 2015, Xiangrong Fang wrote:
Hi all,
I define a procedure like this:
type
TDataHandler = procedure(data: Pointer) of object;
procedure SetHandler(h: TDataHandler); external cdecl;
Now, can I implement SetHandler in a library written in C, then
2015-03-10 0:33 GMT+08:00 OBones obo...@free.fr:
How about using TMethod?
procedure DataHandler(DummySelf: Pointer; data: Pointer);
begin
// do what you want to do, DummySelf is always nil.
end;
var
Method: TMethod;
begin
Method.Data := nil;
Method.Code := @DataHandler;