3

Imaging this scripting code:

procedure A;
begin
  CallToDelphi;
end;

procedure B;
begin
  // do something
end;

I have exposed the procedure "CallToDelphi" to the script. So when it is called, I'm back from script in my Delphi code. I now want to call the script procedure "B" from my Delphi Code. I think is must be hidden in the IdwsProgramExecution-Context. But I didn't found anything yet. I'm looking for a something like that:

procedure CallToDelphi;
begin
  Exec.Invoke('B', []); // Exec is IdwsProgramExecution
end;

Is this somehow possible?

1 Answer 1

2

What you're looking for is probably the IInfo interface which can be used as

Exec.Info.Func['B'].Call([])

There are some more samples in http://code.google.com/p/dwscript/wiki/FirstSteps (scroll down to functions), and also some usage code in the unit tests (UdwsUnitTests notably, see the CallFunc method).

The IInfo serves Delphi-side as the primary way to query RTTI, invoke functions, get/set variables directly, instantiate script-side objects, etc. Most of the sample code for it is currently in the unit tests though.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I already browsed through the unit tests, but didn't find it. Thanks for your guidance. Now it's clear. This is exactly what I was looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.