The process you describe sounds like it could work. Do you get any particular error when you use scheme_eval_compiled_multi() on the result of scheme_compile()?
Although it depends on the application, I would probably take a slightly different approach: Make all scripts modules, and write a glue module that uses the FFI to pull functions out of the host program (instead of having the embedding program push bindings into a Racket environment). The embedding program would export (at the DLL) functions for the glue module, and it would load scripts as module. Then, even if you run a script module from source, it is compiled once as the module is declared; each call into the script becomes more like calling a function instead of `eval`ing an S-expression. At Sun, 26 Jun 2016 05:22:51 -0700 (PDT), Diego Rodriguez wrote: > Hi, > i would like to execute a compiled rack script from an embedding racket > program. > The script should contain references and calls to symbols (functions) > dynamically added to the environment from the embedding program. > I managed to make it work using scheme_eval_string_all but i would like to > avoid parsing the string each time i need to execute the script, so my idea > was to compile it at program startup and then execute the jit compiled > version > of it. > So I tried to parse the string once like do_eval_string_all function does > (eval.c file inside the sources), and instead of evaluating each parsed > s-expression i used scheme_compile to generate the compiled version of each > s-expression. > Then after all the expressions were parsed i used scheme_eval_compiled_multi > to evaluate them, but this doesn't work. > In the eval.c file there is a function called scheme_compile_for_eval, > which i think should be the one to call for this scenario, but it's not > exposed. > > What do you suggest ? Is there another or proper (better) way to do this ? > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

