[cap-talk] Confessions of a C programmer

David-Sarah Hopwood david-sarah at jacaranda.org
Tue Sep 22 16:55:22 PDT 2009


Stiegler, Marc D wrote:
> Sandro Magi wrote:
>> I also wish to clarify what seems to be a common 
>> misconception: OCaml does not compile to C. It has its own 
>> native code generator, and a C-based bytecode VM for 
>> unsupported architectures.
> 
> Sandro, the last time I installed Ocaml on a windows box (about 2 years ago),
> there were two sets of instructions for setting it up to use either the
> Cygwin gcc compiler, or the Visual Studio C compiler, for the final step
> of compilation. The programmer never needs to look at the C intermediary
> code, the programmer just sees executable native code at the end of the
> pipe, but the C is there in an intermediary step. 

Sandro is correct. There are two OCaml compilers, both of which are
installed in a typical OCaml installation:

 - ocamlopt compiles directly to native code;
 - ocamlc compiles to a bytecode file that is also an executable file.

ocamlc depends on a C compiler being available; this is to support
linking with C, and I think it may also be used in making the bytecode
files self-executable.

<http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html>
<http://caml.inria.fr/pub/docs/manual-ocaml/manual024.html>
<http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html>

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com



More information about the cap-talk mailing list