caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@inria.fr
Subject: Easier FFI
Date: Thu, 20 Dec 2007 16:39:15 +0000	[thread overview]
Message-ID: <200712201639.15513.jon@ffconsultancy.com> (raw)


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


             reply	other threads:[~2007-12-20 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 16:39 Jon Harrop [this message]
2007-12-21  3:37 ` [Caml-list] " Dave Benjamin
2007-12-21  3:54   ` Jon Harrop
2007-12-21 11:20 ` Richard Jones
2008-02-01 17:13   ` Alan Falloon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200712201639.15513.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).