fsvb and foreign-typedefs with aggregate types

Luís Oliveira luismbo at gmail.com
Thu Feb 20 20:09:20 UTC 2020


On Thu, 20 Feb 2020 at 15:09, Madhu <enometh at meer.net> wrote:
> defcvar would no longer define a variable that reflects access to the
> object on the C side.
>
> so instead of (setf (foreign-slot-value *s-s-ch* 's-s-ch 'another-char) #\a)
> one would have to do
> (setf (foreign-slot-value (foreign-symbol-pointer "the_s_s_ch")
>        's-s-ch 'another-char) #\a)
>
> This pretty painful when the nesting gets deep.  I started trying to
> convert the tests and I stopped around struct.alignment.4

There's (get-var-pointer '*s-s-ch*) but it's not much better, I agree.
We could have DEFCVAR define a symbol macro for &*S-S-CH* that would
get the pointer, maybe?

For nesting, one can use FOREIGN-SLOT-POINTER explicitly or the
(:pointer foo) for WITH-FOREIGN-SLOTS.

What do you think?

-- 
Luís Oliveira
http://kerno.org/~luis/



More information about the cffi-devel mailing list