[Openmcl-devel] Casting a FFI pointer

Edi Weitz edi at agharta.de
Thu Aug 14 14:25:06 PDT 2003

On Thu, 14 Aug 2003 15:13:31 -0600 (MDT), Gary Byers <gb at clozure.com> wrote:

> Without discussing the merits/demerits of using an ALIEN-like
> mechanism to access foreign objects, it doesn't make sense to try to
> manipulate ALIEN-like things in implementations that (like OpenMCL)
> don't use them.

The whole point of this newly-introduced macro is to support the
dereferencing of a pointer the type of which is not specified. An
example would be a C function foo which is defined as

  void *foo (int bar)

and can return a pointer to a char array _or_ a pointer to a double
array depending on its argument (or depending on the time of the day
or whatever).

In CMUCL, as you explained, the result of dereferencing the pointer
depends on the type info in the ALIEN object so it has to be
coerced. In AllegroCL the "pointer" is just an integer and you can
provide the result type you want at dereferencing time. Thus, the
macro WITH-CAST-POINTER in UFFI is essentially a no-op for AllegroCL.

I don't know OpenMCL but do I understand you right that the same would
be true for OpenMCL?


Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list