Version française
Home     About     Download     Resources     Contact us    
Browse thread
Easier FFI
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Easier FFI

I'm currently revisiting the topic of OpenGL bindings because I'd like to have 
a play with vertex and fragment shaders. Getting shaders up and running from 
C++ code is very easy: just a few calls and you pass your shader programs in 
as strings. However, I have been unable to get this working from OCaml using 
any of the existing OpenGL bindings (most notably GLCaml). This got me 
thinking about FFIs.

GLCaml currently autogenerates its bindings from a custom annotated C header 
file. There are some aspects that I'd like to change. For example, GLCaml 
currently seems to use only bigarrays when strings and ordinary OCaml arrays 
seem preferable in several circumstances.

Rather than invest time and effort into tweaking only GLCaml, I'm wondering 
what people's thoughts are about autogenerated FFIs for OCaml in general?

For example, why can't we have a generic FFI library that allows us to use any 
external library (unsafely) without leaving OCaml? Then we could write or 
generate our bindings entirely in OCaml and forget about these C stubs.

How does this relate to SML's NLFFI?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e