Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Creating nativecode apps
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Creating nativecode apps
From: Jonathan Roewen <jonathan.roewen@gmail.com>

> Let me rephrase. What do the ocaml compilers need a C compiler for?
> And, if I use -output-obj, is the object file created solely by the
> ocaml compilers, or does this depend on a C compiler?

You must distinguish the bytecode and native code cases.
As far as I can follow the code in bytecomp/bytelink.ml and
asmcomp/asmlink.ml, in the first case a C compiler is needed, as
ocamlc generates some glue code written in C. This is not surprising,
as ocamlc knows nothing about native objects, so all interaction
requires some glue compiled with a C compiler, this is also true for
-custom. On the other hand, ocamlopt can generate assembler code, so
it doesn't really require a C compiler. However it requires working
assembler and linker. In some cases it may even choose to use gcc as
front end to either of them, while not feeding it C code.

The problem is of course that generally, if you've got a  linker and
an assembler, you've also got a C compiler. The only exception that
comes to mind is commercial Unixes like Solaris, if you really don't
want to install gcc. So I'm afraid that the answer is rather that
ocamlopt depends on a working compiling environment, even if this
might not include a C compiler.

The only case nothing is required from the environment is when using
ocamlc with shared libraries (i.e. without -custom). This was an
important reason to support them.

Jacques Garrigue