| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | <meta name="generator" content="hevea 2.35"> |
| 6 | <link rel="stylesheet" type="text/css" href="main.css"> |
| 7 | <title>Overview</title> |
| 8 | </head> |
| 9 | <body > |
| 10 | <a href="index.html"><img src="contents_motif.svg" alt="Up"></a> |
| 11 | <a href="main002.html"><img src="next_motif.svg" alt="Next"></a> |
| 12 | <hr> |
| 13 | <h2 id="sec1" class="section">1 Overview</h2> |
| 14 | <p>Camlidl generates stub code for interfacing Caml with C |
| 15 | (as described in chapter “Interfacing with C” of the |
| 16 | <a href="http://caml.inria.fr/ocaml/htmlman/index.html">Objective Caml |
| 17 | reference manual</a>) from an IDL description of the C functions to be |
| 18 | made available in Caml. |
| 19 | Thus, Camlidl automates the most tedious task in interfacing C |
| 20 | libraries with Caml programs. It can also be used to interface Caml |
| 21 | programs with other languages, as long as those languages have a |
| 22 | well-defined C interface.</p><p>In addition, Camlidl provides basic support for COM interfaces and |
| 23 | components. It supports both using COM components (usually written in |
| 24 | C++ or C) from Caml programs, and packaging Caml objects as |
| 25 | COM components that can then be used from C++ or C.</p> |
| 26 | <h3 id="sec2" class="subsection">1.1 What is IDL?</h3> |
| 27 | <p>IDL stands for Interface Description Language. This is a generic term |
| 28 | for a family of small languages that have been developed to provide |
| 29 | type specifications for libraries written in C and C++. Those |
| 30 | languages resembles C declarations (as found in C header files), with |
| 31 | extra annotations to provide more precise types for the arguments and |
| 32 | results of the functions.</p><p>The particular IDL used by Camlidl is inspired by Microsoft’s IDL, |
| 33 | which itself is an extension of the IDL found in DCE (The Open Group’s |
| 34 | Distributed Common Environment). The initial motivation for those IDLs |
| 35 | was to automate the generation of stub code for remote procedure calls |
| 36 | and network objects, where the arguments to the function are marshaled |
| 37 | at the calling site, then sent across the network or through |
| 38 | interprocess communications to a server process, which unmarshals the |
| 39 | arguments, compute the function application, marshal the results, |
| 40 | sends them back to the calling site, where they are unmarshaled and |
| 41 | returned to the caller. IDLs were also found to be very useful for |
| 42 | inter-language communications, since the same type information that |
| 43 | guides the generation of marshaling stubs can be used to generate |
| 44 | stubs to convert between the data representations of several |
| 45 | languages.</p> |
| 46 | <h3 id="sec3" class="subsection">1.2 What is COM?</h3> |
| 47 | <p>COM is Microsoft’s Common Object Model. It provides a set of |
| 48 | programming conventions as well as system support for packaging |
| 49 | C++ objects as executable components that can be used in other |
| 50 | programs, either by dynamic linking of the component inside the |
| 51 | program, or through interprocess or internetwork communications |
| 52 | between the program and a remote server. COM components implement one |
| 53 | or several interfaces, (similar to Caml object types or Java |
| 54 | interfaces) identified by unique 128-bit interface identifiers (IIDs). |
| 55 | COM specifies a standard protocol for reference counting of |
| 56 | components, and for asking a component which interfaces it |
| 57 | implements.</p><p>While the full range of COM services and third-party components is |
| 58 | available only on Microsoft’s Windows operating systems, the basic COM |
| 59 | conventions can also be used on Unix and other operating systems |
| 60 | to exchange objects between Caml and C or C++. Of particular |
| 61 | interest is the encapsulation of Caml objects as COM components, which |
| 62 | can then be used inside larger C or C++ applications; those |
| 63 | applications do not need to know anything about Caml: they just call |
| 64 | the component methods as if they were C++ methods or C |
| 65 | functions, without knowing that they are actually implemented in Caml.</p><p>For more information about COM, see for instance <em>Inside COM</em> |
| 66 | by Dale Rogerson (Microsoft Press), or the |
| 67 | <a href="http://msdn.microsoft.com">Microsoft developer Web site</a>.</p> |
| 68 | <hr> |
| 69 | <a href="index.html"><img src="contents_motif.svg" alt="Up"></a> |
| 70 | <a href="main002.html"><img src="next_motif.svg" alt="Next"></a> |
| 71 | </body> |
| 72 | </html> |