guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FFI and disjoint types


From: Neil Jerram
Subject: Re: FFI and disjoint types
Date: Mon, 01 Mar 2010 20:49:58 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> Hello,
>
> The nice thing about SMOBs is that they allow disjoint C types to be
> mapped to disjoint Scheme types.
>
> With ‘(system foreign)’, C pointers are mapped to Scheme foreign
> objects, regardless of the type of object pointed to.  Thus, to get
> disjoint types in Scheme, foreign objects would need to be boxed in
> structs (since structs are the only way to create disjoint types from
> Scheme).
>
> If this analysis is correct, the resulting code may be somewhat
> inefficient since we end up boxing C pointers twice.
>
> Is this correct?  Thoughts?

Sounds reasonable.  Perhaps (system foreign) could add a way of
declaring foreign pointer types, and of allowing code to state the type
of a pointer at the time of boxing it.

     Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]