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
[email protected]
http://felix-lang.org

_______________________________________________
Ctypes mailing list
[email protected]
http://lists.ocaml.org/listinfo/ctypes

Reply via email to