I am trying to load pre-executed RemObjects Pascal Script into Delphi at runtime. However, when I try to download it, Delphi throws out "Unable to import VALUE_TEAMCODE." Value_TeamCode is a function in my Delphi application that I have already registered with Pascal Script.
That's what I'm doing. Coarse pseudo code below - the actual code is split into several files. In addition, the call to SetCompiled below occurs much later in the application when you need to execute Script.
Note regarding code: FPascalScript is TPSScriptDebugger
... //Register custom functions with Pascal Script FuncsRegister; //Load script FPascalScript.Script.AddStrings(AContent); //Compile script FPascalScript.Compile; //Get compiled script FPascalScript.GetCompiled(sCompiledScript) //Try and set script back in - ERROR Here 'Cannot Import VALUE_TEAMCODE' FPascalScript.PascalScript.Debugger.SetCompiled(sCompiledScript); ...
Maybe I'm going to do it wrong. I'm not sure if you can even download pre-compiled Script.
I searched the RemObjects WebSite Wiki, but the Pascal Script help has been removed. I also searched for various topics here in StackOverflow, but none of them are related to this issue.
One more remark. I already have scripts that compile and execute at runtime without any problems. I need to precompile for performance reasons.
Any help was appreciated.
Update:
The current job is to have one Script engine for Script in my system. Then these engines remain in memory after preliminary compilation. This removes the 30 ms per script compilation overhead that I otherwise had. It also uses a little more memory, but not enough to be a problem.
I would prefer to use only one Script engine. (Therefore, you must load the precompiled script)
delphi pascal pascalscript
Peter Mayes
source share