Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
  parameter
- the int parameter could be the length of the array, or a regular
  parameter
- 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.

-- 
   Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners