TdwsRTTIConnector does not update values for var and out parameters after the call

Issue #23 wontfix
Former user created an issue

Please run the attached sample and press the button. It will call a test script which calls TDwsTestObject.ModifyTest procedure with var parameter and prints output value. The procedure assigns 'bbb' to the value but the value in the script is not updated.

I assume we should add next code to the end of TdwsRTTIConnectorCall.Call to fix it.

for i := 0 to High(args) do begin if (methParams[I].Flags * [pfVar, pfOut]) <> [] then ValueToVariant(paramData[i], args[i][0]); end;

NB. args are declared as const so you may also consider to change the method signature as well.

function TdwsRTTIConnectorCall.Call(const base : Variant; var args : TConnectorArgs) : TData;

Comments (1)

  1. Eric Grange repo owner

    Development on the RTTI connector was essentially stopped at the experimental level as it is not possible to achieve sandboxing or even guarantee stability (lack of memory overwrites, corruptions and leaks) through RTTI.

    One of the primary goals of DWScript is to offer scripting capability to end users, which at the very least means debugging and ability to abort a runaway script at any time without issues to the host application. That is not possible with RTTI, since all kinds of bug in the end-user script can crash or corrupt the host application, so RTTI is unsuitable for offering end-user scripting capability, even without bringing security into the picture :/

    If you want some automated way to expose features, COM is preferable, as the COM interfaces can be made stable vs user errors & debugging.

    If you really want to have an RTTI connector (which I do not recommend for the above reasons, as it will fail in the field when faced with buggy script code), you could start making a project for it.

  2. Log in to comment