Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Issue: By-reference arguments to VBScript functions do not work [58]

0
0

Great Library, really helpful!

I ran into one situation where we have some existing VBScripts, the have subroutines and functions that take ByRef scalar types such as ints, double and the values are being changed in the function.


Here is the code I tested:

VBScriptEngine scriptEngine = new VBScriptEngine(WindowsScriptEngineFlags.EnableDebugging);
double byRefValue = 10.0;
scriptEngine.Execute(@"sub TestSub(ByRef MyParam) : MyParam=20.0 : end sub");
scriptEngine.Script.TestSub(ref byRefValue);


Basically what I was trying to accomplish , was the double values should end up being set to 20.0 , but it always remains at 10.0

I tried changing the double to an object and dynamic and it didn't make a difference.

Any thoughts on how to support this scenario.

Thanks!

Comments: Fixed in [Version 5.4.1](https://clearscript.codeplex.com/SourceControl/changeset/c2200cbd6b77300484927906517035caef3ae323).

Viewing all articles
Browse latest Browse all 2297