Next Previous Up Top Contents Index

4 OLE Automation

4.8 Datatypes

Since the mechanisms of OLE Automation were designed for C and BASIC rather than for Dylan, it does not support the passing of arbitrary Dylan objects. However, instances of the following Dylan classes can be used as method arguments, results, and property values:

<integer>, <machine-word>, <byte-character>, <boolean>, 
<single-float>, <double-float>, <string>

An COM interface can itself be passed as an argument. Also, you can pass instances of <sequence> or <array> as long as each element is of one of these types. (The elements do not necessarily have to be of the same class if the server is prepared to accept heterogeneous data; that will be true automatically if the server is implemented in Dylan.) For a <sequence>, the server will receive the data as a vector, regardless of which subclass of <sequence> was used in the controller.

You can also pass the special value $SQL-NULL as an argument to indicate an unspecified value. This is intended to correspond to the null value of SQL, and not a C NULL pointer.

Note that you cannot pass C pointers, because the controller and server do not necessarily have access to the same address space. Essentially, what is being passed across the dispinterface is a copy of the value.

However, for implementing by-reference parameter passing, it is permissible to pass certain types of C pointers as argument values, but the server can only use the pointer to load or store a value during the duration of the call. Alternatively, a controller can use the convenience functions out-ref and inout-ref to implement by-reference parameters without direct handling of C pointers.

In some cases, a server in another language may require an argument to be passed with a particular representation even though it cannot be unambiguously inferred from the actual value. A Dylan client can use the function pass-as to specify the representation. For example, using the expression pass-as(<C-long>, 1) as a method argument forces the value 1 to be passed as a long value even though it could fit in a short.


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

Next Previous Up Top Contents Index