Implemendet host interface in script

edited 1:14PM in FastScript
Is it possible to write a script with class that implements an
interface that is defined in the host? And then provide the interface
(from the script) to host and using it like a other interfaces?

Example:

Delphi-Host definition:
type
ISomething = interface

function Do(aParam : Variant) : Integer;
end;



script code:
TSomething = class(ISomething, TInterfacedObject)
public
function Do(aParam : Variant) : Integer;
end;

funcion TSomething.Do(aParam : Variant) : Integer;
begin
<code>
result := 0;
end;

Delphi-Host interface use code:
var
ISom : ISomething;
begin
ISom := GetImplementationFromFastScript();
case ISom.Do(some_variant) of
0: <code>
1: <code>
end;

where:
GetImplementationFromFastScript() - a "magical" way to obtain a reference interface implemented in the script.

--
kind regards
Jacek

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.