I was adding types to a library and I ran into some ctypes I'm unsure how to annotate. They are
(_fun -> _pointer)
(_fun -> _double)
Does the pointer get wrapped as a integer, and the double a float? What if I need to restrict numbers to a specific range like -128 to 127 as in a signed char?
Unfortunately my foray into this has also caused me to run into this issue on git so I might have to abandon adding types to the structs.
Did some more digging in the docs and for _double it looks like Float/Flonum is double precision by default so it should be used here.
Includes Racket’s double-precision (default) floating-point numbers and corresponds to the flonum? predicate. This type excludes single-precision floating-point numbers.
@SamPhillips helped me figure out the pointer one. An opaque type is the most appropriate in this situation.
(require/typed ffi/unsafe [#:opaque Pointer cpointer?])