>> Layout rules in general for C are fully fixed by the ABI. >> That’s platform dependent BUT you only need to figure out >> the ABI once per platform. > > Fair enough -- checking the ABI at configuration time could be made to > work, too. But would there be much benefit? Wouldn't it still be > necessary to generate C code (or do something similar, like parse > headers and evaluate constant expressions) to retrieve the values of > enumeration constants?
I don’t know. However at present Cstubs stuff is really worrying. The process involves generating C just so you can get the information to then generate some Ocaml. The resulting Ocaml is fragile, because it only works on the platform you generated it on. It doesn’t work for cross compilation, and it doesn’t have the usual properties of pure Ocaml that it “just works” on all platforms (which is really BIG plus IMHO .. write once, run anywhere). On the other hand just generating C, compiling it, and using that C code everywhere removes some steps. You still have to compile the C on the target platform, but the Ocaml binding to it is invariant (Ctypes uses the ABI data to interpret the terms). I think the point is, why generate C just so you can generete platform dependent Ocaml, when you can just generate the C and bind to the C you generated? You have to compile the C in both cases, but in the second case you just link to it, and you have to link to the foreign library anyhow. Of course I’m using a script which parses the C header files to generate the bindings, so generating some extra C only has an O(1) cost. — john skaller [email protected] http://felix-lang.org _______________________________________________ Ctypes mailing list [email protected] http://lists.ocaml.org/listinfo/ctypes
