Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
nojb committed Jan 16, 2021
1 parent c00d315 commit 29b76fd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
15 changes: 9 additions & 6 deletions manual/manual/cmds/intf-c.etex
Expand Up @@ -1628,7 +1628,7 @@ contain the executable file name.

An alternative is to embed the bytecode in the C code. The
"-output-obj" and "-output-complete-obj" options to "ocamlc" are
provided for this purpose. It causes the "ocamlc" compiler to output a
provided for this purpose. They cause the "ocamlc" compiler to output a
C object file (".o" file, ".obj" under Windows) containing the
bytecode for the OCaml part of the program, as well as a
"caml_startup" function. The C object file produced by "ocamlc
Expand All @@ -1651,16 +1651,19 @@ C code by instead using the "caml_startup_exn" function and testing the result
using {\tt Is_exception_result} (followed by {\tt Extract_exception} if
appropriate).

The "-output-obj" option can also be used to obtain the C source file.
More interestingly, the "-output-complete-obj" option can also produce
The "-output-obj" and "-output-complete-obj" options can also be used to
obtain the C source file.
More interestingly, these options can also produce
directly a shared library (".so" file, ".dll" under Windows) that
contains the OCaml code, the OCaml runtime system and any other static
C code given to "ocamlc" (".o", ".a", respectively, ".obj", ".lib").
This use of "-output-complete-obj" is very similar to a normal linking
This use of "-output-obj" and "-output-complete-obj"
is very similar to a normal linking
step, but instead of producing a main program that automatically runs
the OCaml code, it produces a shared library that can run the OCaml
code on demand. The three possible behaviors of "-output-complete-obj"
to produce a C source code ".c", a C object file ".o", a shared library ".so",
code on demand. The three possible behaviors of "-output-obj"
and "-output-complete-obj"
(to produce a C source code ".c", a C object file ".o", a shared library ".so"),
are selected according to the extension of the resulting file (given
with "-o").

Expand Down
4 changes: 2 additions & 2 deletions manual/manual/cmds/native.etex
Expand Up @@ -102,8 +102,8 @@ These ".cmt" and ".cmti" files are typically useful for code inspection tools.
\section{s:native-options}{Options}

The following command-line options are recognized by "ocamlopt".
The options "-pack", "-a", "-shared", "-c", "-output-obj" and "-output-complete-obj" are mutually
exclusive.
The options "-pack", "-a", "-shared", "-c", "-output-obj" and
"-output-complete-obj" are mutually exclusive.

% Configure boolean variables used by the macros in unified-options.etex
\compfalse
Expand Down
8 changes: 4 additions & 4 deletions manual/manual/cmds/unified-options.etex
Expand Up @@ -444,8 +444,8 @@ Specify the name of the output file produced by the
default output name is "a.out" under Unix and "camlprog.exe" under
Windows. If the "-a" option is given, specify the name of the library
produced. If the "-pack" option is given, specify the name of the
packed object file produced. If the "-output-obj" or "-output-complete-obj" options are given,
specify the name of the output file produced.
packed object file produced. If the "-output-obj" or "-output-complete-obj"
options are given, specify the name of the output file produced.
\nat{If the "-shared" option is given, specify the name of plugin
file produced.}
\comp{If the "-c" option is given, specify the name of the object
Expand Down Expand Up @@ -514,8 +514,8 @@ is embedded in the C code so it is no longer accessible to tools such as

\notop{%
\item["-output-complete-obj"]
Same as "-output-obj" options except the object file produced includes the runtime and
autolink libraries.
Same as "-output-obj" options except the object file produced includes the
runtime and autolink libraries.
}%notop

\nat{%
Expand Down

0 comments on commit 29b76fd

Please sign in to comment.