From: Nicolas C. <war...@fr...> - 2005-05-28 07:44:53
|
> > That's interesting idea, could you give more informations about the goal of > > your project ? > > To write a robust, type-safe OS. > > > Actually you just need to declare in IO.ml the C externals to caml channels > > functions and hide them in the mli so they can't be used directly. Have a > > look at pervasives.ml and .mli sources to see how ocaml is doing. > > I'd prefer to get rid of the channels completely (as well as > printf/fprintf, use of file descriptors, probably other things too), > to avoid writing a lot of libc stub code. > Then you need to write : external open_file : string -> bin:bool -> IO.input = "camlos_open_file" for example, and generate an input from this on the C side. That's quite tricky because You'll have to : a) know about IO.input structure on the C side ( order of record fields ) b) create closures in C using caml API : not very easy. You should really consider the approach of having file_channel primitives in IO.ml for internal usage only. Nicolas |