I'm using racket/draw/unsafe/cairo
and a custom ffi for MagickWand C API.
I have this definition, you can see the last parameter is _bytes
.
(define-mwand MagickExportImagePixels (_fun _MagickWand-pointer _size _size _size _size _string _StorageType _bytes -> _MagickBooleanType))
The cairo function I'm trying to use is
(define-cairo cairo_image_surface_get_data* (_cfun (s : _cairo_surface_t)
-> _pointer)
#:c-id cairo_image_surface_get_data)
Which returns a pointer which then I feed to MagickExportImagePixels
, for now I just added another definition called MagickExportImagePixels/pointer
which is the same as the namesake function but _bytes
is replaced with _pointer
.
Yet I still have the question, how to cast a _pointer
to _bytes
correctly, I just did (cast data-pointer _pointer _bytes)
and it crashed or at least I remember doing this, I also realize that _bytes
in the docs is syntax, so that might be also part of a problem.