[Larceny-users] on NULL and not-NULL pointers in the FFI

Marco Maggi marco.maggi-ipsu at poste.it
Fri Jan 2 14:55:56 EST 2009


My current understanding is that NULL pointers
returned by foreign functions are converted to
#f, but then NULL pointers accepted as arguments
cannot be #f and VOID*? does not accept #f as
valid pointer. Idem for the pointer record
constructor.

This is biting me right now because I want to
invoke "realpath()" with a NULL pointer as
second argument. (By the way, how do I send
a NULL pointer as argument to a foreign
function?)

IMHO this should be changed to make NULL pointers
be pointer records like all the others, and a
VOID*-NULL? predicate should be introduced.

Thinking to the distant future: it probably
requires having two ffi libraries, but it
would be nice to make pointer records be proper
R6RS records as first step in providing typed
pointers through hierarchies of R6RS records.

Typed pointers would help in OOP libraries
to implement multimethod dispatching.
-- 
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"




More information about the Larceny-users mailing list