Next Previous Up Top Contents Index

9 OLE FFI Facilities

9.3 C-to-Dylan name-mapping scheme

This section describes the scheme Functional Objects used to map the C names in the Microsoft OLE/COM API to names fitting Dylan style and coding conventions.

  define constant QueryInterface = IUnknown/QueryInterface;

define constant AddRef = IUnknown/AddRef;

define constant Release = IUnknown/Release;

  status = obj->QueryInterface(IID_Ifoo, & result);

the equivalent Dylan code is:
  let ( status :: <SCODE>, result :: <Interface> ) =
    QueryInterface(obj,$IID-Ifoo);

The names <SCODE> and <HRESULT> are defined as Dylan data types because they are not used as integers even though they are implemented as such in C. (In Dylan, they are actually aliases for <machine-word>.)
  pt->x = x;

becomes in Dylan:
  pt.x-value := x;

   <Interface>
       |
    <LPUNKNOWN>
     /       \
    /       <IUnknown>
<LPOLEOBJECT>  /     \
   /   \      /       \
  /   <IOleObject>    ...
 ...       |
    <my-OleObject>

where <my-OleObject> represents a user-defined Dylan class that provides an implementation of the IOleObject interface. Classes <IUnknown> and <IOleObject> do not have any direct instances.

OLE, COM, ActiveX and DBMS Reference - 31 MAR 2000

Next Previous Up Top Contents Index