4.1 A few words on implementation(s)
The JoCaml system is structured as the Objective Caml system,
with a bytecode compiler jocamlc and a native-code compiler
In fact, JoCaml is a modified Objective Caml.
The JoCaml compilers translate Join constructs into
function calls to an ad-hoc library.
The ad-hoc library is an extension of the thread library
of Objective Caml, which we simply call the threads library.
The threads library comes in two flavors: virtual-machine level
threads and system-level threads.
JoCaml uses system-level threads by default.
As a result of its design, JoCaml inherits the limitations of
Objective Caml thread implementations. In particular, there can be at most
one thread actually executing at a time, even on multi-core machines.
The compilers jocamlc and jocamlopt should be binary
compatible with Objective Caml. More precisely, while installing JoCaml, a
“companion Objective Caml” is defined — see file INSTALL
in the distribution for details.
The companion system must have the
same version number as the JoCaml system. Then, the search paths
for the compiler are completed by the ones of the companion system.
For that reason JoCaml distribution includes a limited subset of
Objective Caml libraries.
4.2 Summary of tool modifications
All JoCaml tools are Objective Caml tools with an initial
“j”: jocamlc jocaml etc.
The bytecode compiler.
By default, jocamlc assumes compilation with respect to the
system threads library.
In that aspect, it behaves like ocamlc with
command line options -thread, with libraries
unix.cma and threads.cma added at link time.
New or modified options are:
Print the version number of the compiler, the location of the
standard library directory and the location of the companion
Objective Caml, if any; then exit.
Act as an Objective Caml compiler as much as possible:
This option is useful mostly for system bootstrap.
Do not recognize the keywords that are specific to JoCaml
(def, spawn and reply).
- Cancel the effect of -thread and -vmthread.
- Suppress implicit link arguments unix.cma
- -thread (resp. -vmthread)
Compile or link multithreaded programs, in combination with the
system (resp. virtual-machine level) threads library.
By contrast with ocamlc, -thread is the default.
The interactive toplevel. By defaults this toplevel includes
the system-level threads library and the unix library.
The JoCaml virtual machine that executes bytecode files produced
C shared library are searched
as ocamlrun does.
However, notice that in case a companion Objective Caml
has been defined at configuration time,
JoCaml ld.conf file includes a copy of this
companion Objective Caml ld.conf.
The native-code compiler.
Added or modified options are the same as for jocamlc, except for
the -vmthread option which does not exist.
Lexer and parser generators. Those two tools are unchanged, except for
The dependency generator. The jocamldep progam accepts JoCaml
sources as input. This default behavior can be changed by the
- Act over pure Objective Caml files.
The tool to build mixed C/JoCaml libraries.
There are two additional (cosmetic) options:
- Alias for -ocamlc cmd.
- -jocamlopt cmd
- Alias for -oocamlopt cmd.
The tool for building custom toplevels.
The produced toplevels accept and execute JoCaml source code.
4.3 Using ocamlbuild
Objective Caml compilation manager,
is able to handle simple JoCaml projects:
it suffice to add command-line option
Then, ocamlbuild will use JoCaml tools in place of Objective Caml tools.