Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Automatic wrapper generator
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-18 (09:25)
From: Olivier Andrieu <andrieu@i...>
Subject: Re: [Caml-list] Automatic wrapper generator
 skaller [18 May 2004]:
 > This is a brief status report concerning the Felix
 > automatic wrapper generator (reason for posting to Caml list
 > explained below).
 > Note of course the generated wrappers are,
 > at least currently, LOW LEVEL and thus not safe.
 > for some time, people have been crying for 'MORE LIBRARIES'
 > for Ocaml.
 > Here's your chance to get THE LOT in one go.

I really don't buy this. There is just not enough information in the C
prototypes to give you a reasonable interface for OCaml. Or does your
generator use annotations (like camlIDL does) ?

For instance, consider this prototype:
  int foo (double *, int);

- the double* can be an array of doubles, an out parameter, an in/out
- the int parameter could be the length of the array, or a regular
- the int return type could really be a boolean

Even if (double *, int) represents an array and its length, the caml
interface is not obvious :
  float array -> int -> ...   (straightforward mapping)
  float array -> ...          (use the array length for the int parameter)
  float array -> pos:int -> len:int -> ... (account for pointer arithmetic)

In the end you get at best a very low-level bunch of autogenerated
unsafe externals, that you have to re-wrap in ocaml to get something
comfortable and/or safe to program with.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: