The bytecode interpreter runs in its own thread which is started once
the interpreter has been successfully initialized and is automatically
stopped if either
different thread. This means that there must be a special facility
that allows both threads to communicate.
- the user leaves the page that contains the applet
- the OCaml program terminates
In the Net_runtime library there is the function "sleep" that waits
automatically calls the OCaml function that can answer. The function
"sleep" is actually an event loop that sequentially replies to all
continue the program with the function "continue".
The Ocaml functions must have been registered earlier using
been performed. This might cause user interaction to be blocked while
JavaCaml is running.
Example: The JavaCaml part
let double ( [| s |] : string array) =
s ^ s
1 (* function has one parameter (always strings) *)
double (* the function itself *)
The applet must have a name (given with the NAME parameter). Assumed
the name is "javacaml" the function "double" is called this way:
answer = document.javacaml.invoke1("double", parameter)
The number in "invoke1" refers to the number of parameters.