That’s what I needed. Thanks! Berthold
> On 10 May 2016, at 18:59, Matthew Flatt <[email protected]> wrote: > > That's an oversight. I'll push an improvement. > > Even with the improvement I have now, checking is not as complete as > you might like. The check ensures that an array value has (at least) > the expected number of elements and that each element's layout (in the > sense of `ctype->layout`) is as expected. Checking only the element > layout is weaker than checking the element type, but requiring the > types to be `eq?` ctypes seems too strong, and the ctype API doesn't > enable a more flexible notion of equality. > > At Tue, 10 May 2016 18:03:07 +0200, Berthold Bäuml wrote: >> 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 > -- ----------------------------------------------------------------------- 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.

