As all we know, in we can use #use directive in OCaml toplevel to load ml files then execute.
And we can also use ocaml.exe to load and execute ml files.
Here my requirement has some changes to these two situations:
I have a main process, who creates a ocaml toplevel to execute scripts, the two process communicates with shared memory and stdin/stdout. The address(token) of shared memory are given in Sys.argv.
The problem is, I want to load ml files dynamically after the creation of process, so the ml to execute is not given at first.
If I start the process with "ocaml.ml xx.ml [params]", the script will be executed at once and I can't simply use #use directive after the beginning of the script.
If I go into interactive mode, I can't give the shared address since once I give these prams, they are considered as ml filename.
So anyone has an idea to make it happen? The ocaml toplevel is a background service and it calls a script who enters an event loop once started.
.ocamlinit
file? – Edward Minnix