### TPaxInvoke Properties

- Address
- CallConv
- This

### TPaxInvoke.Address

> Address of a function or method

>     property Address: Pointer;

> #### Example

>     type
>       TCharRec = record
>         X, Y: Char;
>       end;

>     function MyHostFunc(const U, V: TCharRec): String; stdcall;
>     begin
>       result := U.X + V.Y;
>     end;

>     var
>       R: TCharRec;
>       S: String;
>     begin
>       R.X := 'a';
>       R.Y := 'b';

>       PaxInvoke1.Address := @ MyHostFunc;
>       PaxInvoke1.This := nil; // this is not a method
>       PaxInvoke1.ClearArguments;
>       PaxInvoke1.AddArgAsRecord(R, SizeOf(R));
>       PaxInvoke1.AddArgAsRecord(R, SizeOf(R));
>       PaxInvoke1.SetResultAsAnsiString;
>       PaxInvoke1.CallConv := _ccSTDCALL;
>       PaxInvoke1.CallHost; // call host-defined function
>       S := String(PaxInvoke1.GetResultPtr^);
>       ShowMessage(S);
>       PaxInvoke1.ClearResult;

### TPaxInvoke.CallConv

> Call convention of function or method.

>     property CallConv: Integer;

> STDCALL = 1, REGISTER = 2, CDECL = 3, PASCAL = 4, SAFECALL = 5, MSFASTCALL = 6.

### TPaxInvoke.This

> If you call method of object, you have to assign This property with the object value.

>     property This: Pointer;

> #### Example

>     function TForm1.MyHostMethod(const X, Y: ShortString; Z: Integer): String;
>     begin
>       result := X + Y + IntToStr(z);
>     end;

>     procedure TForm1.Button3Click(Sender: TObject);
>     begin
>       PaxInvoke1.Address := @ TForm1.MyHostMethod;
>       PaxInvoke1.This := Self; // we call a method
>       PaxInvoke1.ClearArguments;
>       PaxInvoke1.AddArgAsShortString('xyz');
>       PaxInvoke1.AddArgAsShortString('uv');
>       PaxInvoke1.AddArgAsInteger(8);
>       PaxInvoke1.SetResultAsAnsiString;
>       PaxInvoke1.CallConv := _ccREGISTER;
>       PaxInvoke1.CallHost; // call host-defined function
>       ShowMessage(String(PaxInvoke1.GetResultPtr^));

>       PaxInvoke1.ClearResult;
>     end;

Copyright © 2006-2008 VIRT Laboratory. All rights reserved.