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
Automatic interfacing of ocaml to c?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-10-04 (22:00)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Automatic interfacing of ocaml to c?
On Tuesday 04 October 2005 21:43, Chris Campbell wrote:
> Message copied below, I sent it to the but it
> doesn't show.  Which is correct? or

I received both the original and this duplicate.

> Has anyone done any work on this?


> I'm in the process of attempting a 
> semi autogenerated binding to opengl using the mesa xml specifications
> of the interface and lablgl.

Have you seen Isaac Trott's idlgl bindings, written using camlidl?

> This is very early days; so far all I've 
> done is map the flat (a portion of the) gl enumeration space to a set
> of types and values, then auto generate tables mapping the ml variants
> to gl enumeration values ala lablgl.
> I have a good idea of what it will do and am just looking for advice
> from anyone who has done this sort of thing before (if any).

I have tried and failed to write bindings to the more complicated (read 
"hideous") parts of OpenGL and GLU, specifically the GLU tesselator.

> The main 
> problems so far arise from the flat gl space and wanting to split that
> up into a more friendly set of types and modules.

There are also problems with typing, e.g. sets of related functions that 
handle polymorphic metadata of the same type between each of the functions. 
This could be implemented using functors, records of functions or objects. 
I'm not sure if it would be better to do more on the OCaml side using Obj or 
to use C.

> In fact, I will only 
> be generating the mundane stuff as some of this mapping is quite
> tricky and using that as a base.  Many of the opengl functions are
> trivially mapped to OCaml but those that don't will be hand coded.

I'm keen to see your results! :-)

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists