When copying a C array into a a field of a C struct there seems to be no “type 
checking”, i.e., at least a check for element type and array length/size. This 
leads to a Segmentation fault when running the code below. Could such a check 
be added? The relevant information should be available to (make-ct or 
set-ct-arr …).


#lang racket
(require ffi/unsafe)

(define _at2 (_array _double 5000000))
(define _at1 (_array _double 5))

(define-cstruct _ct ([arr _at2]))
(define a (ptr-ref (malloc _at1) _at1))
(define c (make-ct a))


Best,
Berthold

-- 
-----------------------------------------------------------------------
Berthold Bäuml -- Head of Autonomous Learning Robots Lab
DLR, Robotics and Mechatronics Center (RMC)
Münchner Str. 20, D-82234 Wessling
Phone +49 8153 282489
http://www.robotic.de/Berthold.Baeuml

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to