[Openmcl-devel] Casting a FFI pointer

Gary Byers gb at clozure.com
Thu Aug 14 21:37:27 UTC 2003

On Thu, 14 Aug 2003, Edi Weitz wrote:

> 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?

Yes.  A pointer is basically the same thing that CMUCL would call a SAP;
the foreign type information is expressed in the operation that references

(pref p :rectangle.width) ;;(where "pref" is a "pointer-reference" operator)
(pref p :circle.radius)

could both be applied to the same pointer P.  In this example, at least
one of these references would almost certainly yield an unexpected result,
unless P is pointing at a rectangular circle ...

> Thanks,
> Edi.

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

More information about the Openmcl-devel mailing list