delphi - Injecting interface implementation into script -
how 1 supposed "inject interface implementation" script? define interface type in tdwsunit, like
ifoo = interface procedure bar; end;
now how can implement function returns array of ifoo
(or list of ifoo or single ifoo matter) in script?
i tryed add ifoo item instances
collection of unit resulted in error:
syntax error: tdwsunit: "utest" -- tdwsinstance: "tmp" -- autoinstantiate true datatype "ifoo" not class
creating variable of ifoo type compiles, , it's onreadvar
event fires, i'm supposed return there value
?
i guess define class each interface , create instances of classes seems kinda roundabout way don't need classes per se, want expose information script via interface types... there way return array of "interface instances" script?
update
so, have figured out how return array delphi side script side, need find way create "interface instances" put result array... have far:
in descendant of tdwsunit
create function (actually method guess thats irrelevant)
meth := typclass.methods.add; meth.name := 'getdata'; meth.resulttype := 'array of string'; meth.oneval := h_evalfnc_getdata;
and in oneval
procedure tmyunit.h_evalfnc_getdata(info: tprograminfo; extobject: tobject); begin info.resultvars.member['length'].value := 2; info.resultvars.element([0]).value := 'hello'; info.resultvars.element([1]).value := 'word'; end;
now need change result type array of ifoo
, figure out how create array elements in oneval
hadler... hints on how welcome.
Comments
Post a Comment