caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Foreign function interface generator with examples
@ 2001-04-17 20:20 David Fox
  2001-04-18  3:06 ` David Fox
  0 siblings, 1 reply; 8+ messages in thread
From: David Fox @ 2001-04-17 20:20 UTC (permalink / raw)
  To: caml-list

This is to announce a package for generating ocaml foreign function
interfaces.  It is designed to allow you to specify the interface to C
types and data using ocaml code, which is then translated into a mix
of C code and ocaml external declarations.  It is patterned after the
foreign function facilities of Manuel Serrano's Bigloo Scheme
compiler, and it even includes a program to convert a set of Bigloo
directives into an ocaml specification.  Furthermore, Bigloo includes
a program to convert C header files into Bigloo foreign interface
directives, so the automatic generation of these interfaces is within
reach.

Several examples are included, one called "libc.ml" which provides
access to a few libc functions and structures.  It includes getenv,
gettimeofday and the timeval struct, fopen, fread, fclose, and a few
others.  The second is x.ml, which was automatically generated from a
scheme file xlib.sch, which itself was generated from the C header
files for Xlib using the cigloo tool, which is part of the bigloo
distribution.  From this it builds xtop, a top level with access to
the X library, and "hello", a translation to ocaml of a small Xlib
example program borrowed from a book by Oliver Jones.  (Warning, as of
ocaml-3.01 the xtop program gets a segmentation fault.)  The third
example is in the xextra subdirectory, an X library extension written
in C++ and an image viewer program "xextra-test."  Left mouse button
drags, middle and right buttons zoom in and out.

There are more than a few remaining rough spots in the program.  I
haven't tried some of the types it purports to handle.  This situation
should improve in the coming weeks.  This is only my second ocaml
program, so I am making this preliminary release to try and get some
comments and suggestions about whether the thing works, about any
aspect of the design or implementation that people want to tell me
about, or even whether the idea of generating FFI's this way has
value.  And if anyone wants to help.  You may notice a few peculiar
things about the program:

  1) I don't understand the module system,
  2) I don't understand signatures,
  3) I don't understand labels,

and so on and so on.

So, get it here: ftp://ftp.fox-thompson.com/pub/ffi.tar.gz

David Fox
April, 2001
La Jolla, CA
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Foreign function interface generator with examples
  2001-04-17 20:20 [Caml-list] Foreign function interface generator with examples David Fox
@ 2001-04-18  3:06 ` David Fox
  2001-04-18 13:53   ` David Fox
  0 siblings, 1 reply; 8+ messages in thread
From: David Fox @ 2001-04-18  3:06 UTC (permalink / raw)
  To: caml-list

Argh.  My cable modem has been without power for a couple of hours.
If you tried to download from ftp.fox-thompson.com please try again!
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Foreign function interface generator with examples
  2001-04-18  3:06 ` David Fox
@ 2001-04-18 13:53   ` David Fox
  2001-04-20  3:01     ` David Fox
  0 siblings, 1 reply; 8+ messages in thread
From: David Fox @ 2001-04-18 13:53 UTC (permalink / raw)
  To: caml-list

David Fox <dsfox@COGSCI.ucsd.edu> writes:

> Argh.  My cable modem has been without power for a couple of hours.
> If you tried to download from ftp.fox-thompson.com please try again!

If you are having any trouble with my ftp server you can also try

  http://www.fox-thompson.com/dsf/ffi/index.html
  http://www.fox-thompson.com/dsf/ffi/ffi-1.0.tar.gz
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Foreign function interface generator with examples
  2001-04-18 13:53   ` David Fox
@ 2001-04-20  3:01     ` David Fox
  2001-04-20  8:52       ` Chris Hecker
                         ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: David Fox @ 2001-04-20  3:01 UTC (permalink / raw)
  To: caml-list

I'm wondering whether to make further releases of the foreign function
interface generator - I've fixed a few things that weren't quite
working, like pointer arithmetic and dereferencing, problems with
zooming in the image viewer, makefile dependencies and so forth.  If
nobody is interested in this package I don't want to clutter up the
mailing list with additional announcements.
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Foreign function interface generator with examples
  2001-04-20  3:01     ` David Fox
@ 2001-04-20  8:52       ` Chris Hecker
  2001-04-20  9:37       ` jeanmarc.eber
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Chris Hecker @ 2001-04-20  8:52 UTC (permalink / raw)
  To: David Fox, caml-list


I'm interested, so please keep posting.  I downloaded it but haven't taken a close look yet.  I plan on doing the "dynamic" part of the FFI stuff relatively soon (dynalink to arbitrary functions with arbitrary parms and return types, or relatively arbitrary), and there's also the dlopen library that does some of this too.

It would be great if it was trivial to get the base ocaml installation to work with arbitrary FFIs out of the box.  It sounds like the CDK would be a good place for this (or even the core libraries if we get all of these things portable, rock solid, and general).

Chris

At 08:01 PM 4/19/01 -0700, David Fox wrote:
>I'm wondering whether to make further releases of the foreign function
>interface generator - I've fixed a few things that weren't quite
>working, like pointer arithmetic and dereferencing, problems with
>zooming in the image viewer, makefile dependencies and so forth.  If
>nobody is interested in this package I don't want to clutter up the
>mailing list with additional announcements.
>-------------------
>To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Foreign function interface generator with examples
  2001-04-20  3:01     ` David Fox
  2001-04-20  8:52       ` Chris Hecker
@ 2001-04-20  9:37       ` jeanmarc.eber
  2001-04-20 11:51       ` Fabrice Le Fessant
  2001-04-20 22:02       ` David Fox
  3 siblings, 0 replies; 8+ messages in thread
From: jeanmarc.eber @ 2001-04-20  9:37 UTC (permalink / raw)
  To: David Fox; +Cc: caml-list

En réponse à David Fox <dsfox@cogsci.ucsd.edu>:

> I'm wondering whether to make further releases of the foreign function
> interface generator - I've fixed a few things that weren't quite
> working, like pointer arithmetic and dereferencing, problems with
> zooming in the image viewer, makefile dependencies and so forth.  If
> nobody is interested in this package I don't want to clutter up the
> mailing list with additional announcements.

No David, please, please put further release information onto this
mailing list.
Be sure that there *are* people who follow this work with *big*
interest. :-)
I think that an *easy* FFI (you call it "out of the box") is one of the
most important stuff to do for Ocaml. Most of us know that there aren't
any *impossibilities* (more or less anything *can* be done, but you have
to use exactly the correct macros etc...), but its not .... yes, say
"out of the box".

You should also, I think, consider a "submission" to Gerd Stolpmann's
OCaml link list.

So again, keep us please informed about *any* new release of your FFI
work.

last but least (no flame here): please don't *force* us to use labels....!

Jean-Marc Eber
President
LexiFi Technologies
17, square Edouard VII
F-75009 Paris - France
tél : 33 1 53 43 92 48
fax: 33 1 53 43 94 94
email: jeanmarc.eber@lexifi.com
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Foreign function interface generator with examples
  2001-04-20  3:01     ` David Fox
  2001-04-20  8:52       ` Chris Hecker
  2001-04-20  9:37       ` jeanmarc.eber
@ 2001-04-20 11:51       ` Fabrice Le Fessant
  2001-04-20 22:02       ` David Fox
  3 siblings, 0 replies; 8+ messages in thread
From: Fabrice Le Fessant @ 2001-04-20 11:51 UTC (permalink / raw)
  To: David Fox; +Cc: caml-list


It might be interesting to put this program in the CDK...

- Fabrice

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] Foreign function interface generator with examples
  2001-04-20  3:01     ` David Fox
                         ` (2 preceding siblings ...)
  2001-04-20 11:51       ` Fabrice Le Fessant
@ 2001-04-20 22:02       ` David Fox
  3 siblings, 0 replies; 8+ messages in thread
From: David Fox @ 2001-04-20 22:02 UTC (permalink / raw)
  To: caml-list

Thanks to everyone for the feedback.  I've created an ocamlffi project
on sourceforge, and while that is coming on-line I have placed
ffi-1.1.tar.gz on my home ftp and http servers.  You can get it from

   http://www.fox-thompson.com/dsf/ffi/

I will also enter the project into the two link databases.  If you
have an older version you should dump it for this new version - older
versions had dependencies on files that are only on my machine.
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-04-20 22:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-17 20:20 [Caml-list] Foreign function interface generator with examples David Fox
2001-04-18  3:06 ` David Fox
2001-04-18 13:53   ` David Fox
2001-04-20  3:01     ` David Fox
2001-04-20  8:52       ` Chris Hecker
2001-04-20  9:37       ` jeanmarc.eber
2001-04-20 11:51       ` Fabrice Le Fessant
2001-04-20 22:02       ` David Fox

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).