| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" |
| 2 |
"http://www.w3.org/TR/REC-html40/loose.dtd"> |
| 3 |
<HTML> |
| 4 |
<HEAD> |
| 5 |
|
| 6 |
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| 7 |
<META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14"> |
| 8 |
<TITLE> |
| 9 |
Overview |
| 10 |
</TITLE> |
| 11 |
</HEAD> |
| 12 |
<BODY > |
| 13 |
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> |
| 14 |
<A HREF="main002.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> |
| 15 |
<HR> |
| 16 |
|
| 17 |
<H2><A NAME="htoc1">1</A> Overview</H2> |
| 18 |
Camlidl generates stub code for interfacing Caml with C |
| 19 |
(as described in chapter ``Interfacing with C'' of the |
| 20 |
<A HREF="http://caml.inria.fr/ocaml/htmlman/index.html">Objective Caml |
| 21 |
reference manual</A>) from an IDL description of the C functions to be |
| 22 |
made available in Caml. |
| 23 |
Thus, Camlidl automates the most tedious task in interfacing C |
| 24 |
libraries with Caml programs. It can also be used to interface Caml |
| 25 |
programs with other languages, as long as those languages have a |
| 26 |
well-defined C interface.<BR> |
| 27 |
<BR> |
| 28 |
In addition, Camlidl provides basic support for COM interfaces and |
| 29 |
components. It supports both using COM components (usually written in |
| 30 |
C++ or C) from Caml programs, and packaging Caml objects as |
| 31 |
COM components that can then be used from C++ or C.<BR> |
| 32 |
<BR> |
| 33 |
<A NAME="toc1"></A> |
| 34 |
<H3><A NAME="htoc2">1.1</A> What is IDL?</H3> |
| 35 |
IDL stands for Interface Description Language. This is a generic term |
| 36 |
for a family of small languages that have been developed to provide |
| 37 |
type specifications for libraries written in C and C++. Those |
| 38 |
languages resembles C declarations (as found in C header files), with |
| 39 |
extra annotations to provide more precise types for the arguments and |
| 40 |
results of the functions.<BR> |
| 41 |
<BR> |
| 42 |
The particular IDL used by Camlidl is inspired by Microsoft's IDL, |
| 43 |
which itself is an extension of the IDL found in DCE (The Open Group's |
| 44 |
Distributed Common Environment). The initial motivation for those IDLs |
| 45 |
was to automate the generation of stub code for remote procedure calls |
| 46 |
and network objects, where the arguments to the function are marshaled |
| 47 |
at the calling site, then sent across the network or through |
| 48 |
interprocess communications to a server process, which unmarshals the |
| 49 |
arguments, compute the function application, marshal the results, |
| 50 |
sends them back to the calling site, where they are unmarshaled and |
| 51 |
returned to the caller. IDLs were also found to be very useful for |
| 52 |
inter-language communications, since the same type information that |
| 53 |
guides the generation of marshaling stubs can be used to generate |
| 54 |
stubs to convert between the data representations of several |
| 55 |
languages.<BR> |
| 56 |
<BR> |
| 57 |
<A NAME="toc2"></A> |
| 58 |
<H3><A NAME="htoc3">1.2</A> What is COM?</H3> |
| 59 |
COM is Microsoft's Common Object Model. It provides a set of |
| 60 |
programming conventions as well as system support for packaging |
| 61 |
C++ objects as executable components that can be used in other |
| 62 |
programs, either by dynamic linking of the component inside the |
| 63 |
program, or through interprocess or internetwork communications |
| 64 |
between the program and a remote server. COM components implement one |
| 65 |
or several interfaces, (similar to Caml object types or Java |
| 66 |
interfaces) identified by unique 128-bit interface identifiers (IIDs). |
| 67 |
COM specifies a standard protocol for reference counting of |
| 68 |
components, and for asking a component which interfaces it |
| 69 |
implements.<BR> |
| 70 |
<BR> |
| 71 |
While the full range of COM services and third-party components is |
| 72 |
available only on Microsoft's Windows operating systems, the basic COM |
| 73 |
conventions can also be used on Unix and other operating systems |
| 74 |
to exchange objects between Caml and C or C++. Of particular |
| 75 |
interest is the encapsulation of Caml objects as COM components, which |
| 76 |
can then be used inside larger C or C++ applications; those |
| 77 |
applications do not need to know anything about Caml: they just call |
| 78 |
the component methods as if they were C++ methods or C |
| 79 |
functions, without knowing that they are actually implemented in Caml.<BR> |
| 80 |
<BR> |
| 81 |
For more information about COM, see for instance <EM>Inside COM</EM> |
| 82 |
by Dale Rogerson (Microsoft Press), or the |
| 83 |
<A HREF="http://msdn.microsoft.com">Microsoft developer Web site</A>.<BR> |
| 84 |
<BR> |
| 85 |
<HR> |
| 86 |
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> |
| 87 |
<A HREF="main002.html"><IMG SRC ="next_motif.gif" ALT="Next"></A> |
| 88 |
</BODY> |
| 89 |
</HTML> |