CamlIDL
CamlIDL is a stub code generator and COM binding for Objective Caml.
What is CamlIDL?
CamlIDL comprises two parts:
- A stub code generator that generates the C stub code required for
the Caml/C interface, based on an MIDL specification. (MIDL stands
for Microsoft's Interface Description Language; it looks like
C header files with some extra annotations, plus a notion of object
interfaces that look like C++ classes without inheritance.)
- A (currently small) library of functions and tools to import COM
components in Caml applications, and export Caml code as COM
components.
Using CamlIDL
CamlIDL can be used in several ways:
- Under Unix and Windows, as a stub code generator for using C
libraries from Caml. It takes care of the gory details of
the Caml/C interface, such as all those pesky
Val_xxx
and Xxx_val
macros, proper registration of GC roots, the different calling
conventions from bytecode and from native-code, etc.
- Under Unix and Windows, as a simple interface between Caml classes
and C++ classes. The C++ fragment supported is that corresponding
to COM interfaces, i.e. interface polymorphism, but not inheritance.
Communication in both directions (COM/C++ object to Caml object
and Caml object to COM/C++ object) is provided.
- Under Windows, as a COM binding for Caml. There are two applications:
- Use COM components from Caml applications. This should eventually
allow Caml code to exploit many Windows libraries and "script"
many Windows applications. See the H/Direct papers for nice
examples. This hasn't been tried yet with CamlIDL, because of
the incredible lack of documentation on Microsoft's components
and on Microsoft's IDL extensions they use in their interfaces.
- Encapsulate Caml code in COM components that can be used in
other applications. This offers great potential for writing
the juicy bits of an application in OCaml and use C++ or Visual
Basic or Internet Explorer or whatever Microsoft behemoth to do
the GUI and other boring parts. Currently, CamlIDL can create
"in-proc servers" for Caml components (i.e. DLLs that are registered
in the system registry and loaded automatically in applications
that use the components). "Out-of-proc" servers and distributed
objects are not supported yet. Currently, only native interfaces
are fully supported; CamlIDL provides only very preliminary support
for dispatch interfaces.
For more information
Download CamlIDL
Version 1.05: (for Objective Caml 3.08 and up)
Version 1.04: (for Objective Caml 3.02 to 3.07)
Caml -
Cristal -
Homepages -
Contact Web Administrator -
Last modified: 2004/07/13