From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id RAA05783 for caml-redistribution; Tue, 19 Sep 1995 17:22:08 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id RAA05753 for ; Tue, 19 Sep 1995 17:19:26 +0200 Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.6.10/8.6.9) with ESMTP id RAA06589 for ; Tue, 19 Sep 1995 17:19:25 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.6.10/8.6.6) with ESMTP id RAA01775 for ; Tue, 19 Sep 1995 17:19:25 +0200 Received: from bnr.ca (x400gate.bnr.ca [192.58.194.73]) by concorde.inria.fr (8.6.10/8.6.9) with SMTP id RAA06473 for ; Tue, 19 Sep 1995 17:17:08 +0200 X400-Received: by mta bnr.ca in /PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/; Relayed; Tue, 19 Sep 1995 11:06:28 -0400 X400-Received: by /PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/; Relayed; Tue, 19 Sep 1995 11:04:52 -0400 X400-Received: by /PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/; Relayed; Tue, 19 Sep 1995 11:03:00 -0400 Date: Tue, 19 Sep 1995 11:03:00 -0400 X400-Originator: /dd.id=1581776/g=jeff/i=jd/s=sparkes/@bnr.ca X400-MTS-Identifier: [/PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/;bcars520.b.753:19.08.95.15.04.52] X400-Content-Type: P2-1984 (2) Content-Identifier: building stub... From: "jeff (j.d.) sparkes" Sender: weis Message-ID: <"24806 Tue Sep 19 11:05:34 1995"@bnr.ca> To: caml-list@margaux.inria.fr 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