[ocaml-ctypes] Another dumb question
john skaller
skaller at internode.on.net
Wed Dec 27 05:33:38 GMT 2017
This should be a quicky….
Suppose I have some messy struct in C which is generally used
via a pointer. Eg
void f (messy_struct *, int)
Instead of trying to provide field access I think I’d just like to make it
abstract. So I would say
type messy_t
and
let messy_c = ptr void
and then
let f = foreign “f” = (messy_c @-> int @-> returning void)
Does that seem right? (where messy_t is the Ocaml type and
messy_c is the value encoding the view).
Actually I would like to use “abstract” but there’s doesn’t seem like
a convenient way to make an abstract type “the same size and
alignment as a pointer”. That has the added advantage of
preventing a pointer coercion.
—
john skaller
skaller at users.sourceforge.net
http://felix-lang.org
More information about the Ctypes
mailing list