I'd like to create a cstruct which has an array as one of its fields. For the sake of the example, let's say the array is an array of integers. When I try create a new instance of the cstruct, I don't know how to initialize the array field. Here is a simple example:
#lang racket (require ffi/unsafe) (define _args (make-array-type _uint64 4)) (define-cstruct _mystruct ( [id _uint8] [flag _bool] [args _args])) (make-mystruct 123 #f #(1 2 3 4))
The error I get is this:
$ racket array.rkt ptr-set!: given value does not fit primitive C type C type: (_array ....) given value: '#(1 2 3 4) context...:
It must be something simple that I am missing. Can somebody give me a hint?