caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* building stubs and modules from ANSI C include files
@ 1995-09-19 15:03 jeff (j.d.) sparkes
  1995-09-20 12:12 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: jeff (j.d.) sparkes @ 1995-09-19 15:03 UTC (permalink / raw)
  To: caml-list

I've been thinking about the problem of interfacing to external C
libraries.

The tkcompiler program in camltk4 is very good start, but it's not
that general.

It seems that the "external" keyword in CSL gives most of the
information about how to call a C function.  It should be possible to
build the stub routines from a module description.

And it should be possible to build a module description from an ANSI C
include file which gives the types of all of the arguments.

What's missing?  Off the top of my head... please feel free to
contribute more...
- no way to say that returned memory needs to be freed
- how to raise exceptions, and which ones...
- descriptions of C structures that are returned or passed in
- currently no interface to dlopen if it exists.  Easy to add on
  Solaris, at least.

A useful experiment would be to try and generate the current libunix
and libstr just from include files.  I'll try to take a look at what
would be needed.

I got started thinking about this because I wanted DLL support on
windows.  Since I know nothing about windows, I thought about how I'd
do this on unix.  Once its done there, maybe we can transfer the interface.


--
Jeff Sparkes
jsparkes@bnr.ca    Bell-Northern Research, Ottawa, Ontario, Canada




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

end of thread, other threads:[~1995-09-20 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-09-19 15:03 building stubs and modules from ANSI C include files jeff (j.d.) sparkes
1995-09-20 12:12 ` Xavier Leroy

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