On 20 October 2014 16:28, Trevor Smith <[email protected]> wrote: > Jeremy -- I like the functor idea + first class modules: it is elegant. > However I agree with Daniel's point about maintainability.
Yes, the need to keep things in sync with a potentially changing implementation is certainly a drawback. > If I use the allocate w/ a c function that returns the size of the struct I > will be good to go. Then have ctypes reference public fields Careful: giving a partial definition of the struct in ctypes will work well as long as you're dealing with a prefix -- i.e. when the public fields are all at the beginning of the struct. That doesn't appear to be the case with libuv, where public and private fields are sometimes interleaved. The other approaches Daniel suggests -- either defining accessors in C, or treating the struct types as abstract -- should work well, though. This discussion is a useful reminder that ctypes really needs support for retrieving struct layout details from the declared API. I'll look at how to add that support later this week and report back. _______________________________________________ Ctypes mailing list [email protected] http://lists.ocaml.org/listinfo/ctypes
