Chez scheme foreign function interface is a bit verbose (not as wordy as common lisp cffi package at least, holy shit i trimmed hundreds of lines of code switching to chez).
I think I need to write a macro that can do a proper list initialization for a block of memory.
(let ([sel-vertices (make-ftype-pointer pos2 (foreign-alloc (* 4 (foreign-sizeof pos2))))]
[sel-indices (make-ftype-pointer unsigned-32 (foreign-alloc (* 6 (foreign-sizeof unsigned-32))))]
[geometry (make-ftype-pointer mesh-geometry (foreign-alloc (foreign-sizeof mesh-geometry)))]
[sel-instances (make-ftype-pointer pos3-pos3-color4 (foreign-alloc (foreign-sizeof pos3-pos3-color4)))]
[instance-data (make-ftype-pointer mesh-instance-data (foreign-alloc (foreign-sizeof mesh-instance-data)))])
...
(ftype-set! unsigned-32 () sel-indices 0 0)
(ftype-set! unsigned-32 () sel-indices 1 1)
(ftype-set! unsigned-32 () sel-indices 2 2)
(ftype-set! unsigned-32 () sel-indices 3 0)
(ftype-set! unsigned-32 () sel-indices 4 3)
(ftype-set! unsigned-32 () sel-indices 5 1)
Code above is a snippet that allocates a block of memory for six 32 bit unsigned integers and sets the values.