我在我的一个项目中使用这个超级对象单元作为 rpc 协议,在一个远程调用过程中(签名有一个 var Result arg)我想知道如何使用那个 arg...
没有文档吗?谢谢。
program test_rpc;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ELSE}
{$APPTYPE CONSOLE}
{$ENDIF}
uses
SysUtils, superobject;
procedure controler_method1(const This, Params: ISuperObject; var Result: ISuperObject);
var
i: Integer;
begin
write('action called with params ');
writeln(Params.AsString);
try
// How do i use Result arg to return a value ? as if it were a function returning string
Result
except
exit;
end;
end;
var
s: ISuperObject;
begin
s := TSuperObject.Create;
s.M['controler.action1'] := @controler_method1;
try
s['controler.action1("HHAHAH")'];
finally
s := nil;
writeln('Press enter ...');
readln;
end;
end.