/usr/share/doc/camlidl/html/main004.html is in camlidl-doc 1.04-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14">
<TITLE>
Using camlidl
</TITLE>
</HEAD>
<BODY >
<A HREF="main003.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="main005.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>
<H2><A NAME="htoc24">4</A> Using <TT>camlidl</TT></H2>
<A NAME="toc21"></A>
<H3><A NAME="htoc25">4.1</A> Overview</H3>
The <TT>camlidl</TT> stub generator is invoked as follows:
<PRE>
camlidl <I>options</I> <I>file1</I>.idl <I>file2</I>.idl ...
</PRE>
For each file <I>f</I><TT>.idl</TT> given on the command line, <TT>camlidl</TT>
generates the following files:
<UL><LI>
A Caml interface file <I>f</I><TT>.mli</TT> that defines the Caml view
of the IDL file. It contains Caml definitions for the types declared
in the IDL file, as well as declarations for the functions and the
interfaces.
<LI>A Caml implementation file <I>f</I><TT>.ml</TT> that implements the
<I>f</I><TT>.mli</TT> file.
<LI>A C source file <I>f</I><TT>_stubs.c</TT> that contains the stub functions for
converting between C and Caml data representations.
<LI>If the <TT>-header</TT> option is given, a C header file <I>f</I><TT>.h</TT>
containing C declarations for the types declared in the IDL file.
</UL>
The generated <TT>.ml</TT> and <TT>.c</TT> files must be compiled and linked with
the remainder of the Caml program.<BR>
<BR>
<A NAME="toc22"></A>
<H3><A NAME="htoc26">4.2</A> Options</H3>
The following command-line options are recognized by <TT>camlidl</TT>.
<DL COMPACT=compact><DT><B><TT>-cpp</TT></B><DD>
Pre-process the source IDL files with the C preprocessor. This option
is set by default.<BR>
<BR>
<DT><B><TT>-D </TT> <I>symbol</I></B><B><TT>=</TT><I>value</I></B><DD>
Define a preprocessor symbol. The option <TT>-D</TT><I>symbol</I><TT>=</TT><I>value</I>
is passed to the C preprocessor. The <I>value</I> can be omitted,
as in <TT>-D</TT> <I>symbol</I>, and defaults to <TT>1</TT>.<BR>
<BR>
<DT><B><TT>-header</TT></B><DD>
Generate a C header file <I>f</I><TT>.h</TT> containing C declarations for the
types and functions declared in the IDL file <I>f</I><TT>.c</TT>.<BR>
<BR>
<DT><B><TT>-I </TT> <I>dir</I></B><DD>
Add the directory <I>dir</I> to the list of directories searched for
<TT>.idl</TT> files, as given on the command line or recursively loaded
by <TT><FONT COLOR=blue>import</FONT></TT> statements.<BR>
<BR>
<DT><B><TT>-keep-labels</TT></B><DD>
Keep the Caml names of record labels as specified in the IDL file.
Do not prefix them with the name of the enclosing struct, even if they
appear in several struct definitions.<BR>
<BR>
<DT><B><TT>-nocpp</TT></B><DD>
Suppresses the pre-processing of source IDL files.<BR>
<BR>
<DT><B><TT>-no-include</TT></B><DD>
By default, <TT>camlidl</TT> emits a <TT>#include "</TT><I>f</I><TT>.h"</TT> statement in
the file <I>f</I><TT>.c</TT> containing the generated C code.
The <I>f</I><TT>.h</TT> header file being included is
either the one generated by <TT>camlidl -header</TT>, or generated by another
tool (such as Microsoft's <TT>midl</TT> compiler) from the IDL file, or
hand-written. The <I>f</I><TT>.h</TT> file is assumed to provide all C type
declarations needed for compiling the stub code.<BR>
<BR>
The <TT>-no-include</TT> option suppresses the automatic inclusion of the
<I>f</I><TT>.h</TT> file. The IDL file should then include the right header
files and provide the right type declarations via <TT><FONT COLOR=blue>quote</FONT></TT> statements.<BR>
<BR>
<DT><B><TT>-prefix-all-labels</TT></B><DD>
Prefix all Caml names of record labels with the name of the enclosing
struct. The default is to prefix only those labels that could cause
ambiguity because they appear in several struct definitions.<BR>
<BR>
<DT><B><TT>-prepro</TT> <I>preprocessing-command</I></B><DD>
Set the command that is executed to pre-process the source IDL files.
The default is the C preprocessor.</DL>
<A NAME="toc23"></A>
<H3><A NAME="htoc27">4.3</A> The <TT>camlidldll</TT> script</H3>
Under Windows, a <TT>bash</TT> script called <TT>camlidldll</TT> is provided to
automate the construction of a DLL containing a COM component written
in Caml.<BR>
<BR>
The script <TT>camlidldll</TT> accepts essentially the same command-line
arguments and options as the <TT>ocamlc</TT> compiler. (It also accepts
<TT>.tlb</TT> type library files on the command-line; see
section <A HREF="main006.html#s-dispatch">6.3</A>, ``Dispatch interfaces'', for more
information on type libraries.)
It produces a DLL file that encapsulates the Caml and C object files
given on the command line.<BR>
<BR>
Use <TT>regsvr32 /s </TT><I>file</I><TT>.dll</TT> to record the components in the
system registry once it is compiled to a DLL.<BR>
<BR>
<HR>
<A HREF="main003.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="main005.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
|