Version française
Home     About     Download     Resources     Contact us    
Browse thread
building stubs and modules from ANSI C include files
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: jeff (j.d.) sparkes <jsparkes@b...>
Subject: building stubs and modules from ANSI C include files
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