From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA03981; Tue, 4 Sep 2001 17:08:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA03614 for ; Tue, 4 Sep 2001 17:08:56 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f84F8uf12289 for ; Tue, 4 Sep 2001 17:08:56 +0200 (MET DST) Received: from akasha.ijm.jussieu.fr (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.11.3/jtpda-5.3.3) with ESMTP id f84F8pO35373 ; Tue, 4 Sep 2001 17:08:51 +0200 (CEST) Received: by akasha.ijm.jussieu.fr (Postfix, from userid 11004) id B9B243BFE9; Tue, 4 Sep 2001 17:08:41 +0200 (CEST) From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15252.61049.619888.392717@akasha.ijm.jussieu.fr> Date: Tue, 4 Sep 2001 17:08:41 +0200 To: "Jeremy Fincher" Cc: Subject: Re: [Caml-list] getting fd behind a channel from C In-Reply-To: References: <15252.37130.686271.39272@akasha.ijm.jussieu.fr> X-Mailer: VM 6.95 under Emacs 20.7.1 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Jeremy Fincher [Tuesday 4 September 2001] : > > in the OCaml source tree, look at byterun/io.h : it contains > > definitions and macros to access caml channels from C : > I already found this, but there's no way to get to this from the standard > C/O'Caml interface. You just have to take the io.h from the OCaml tree, put with your C files, #include it, at it works ! You can just keep the relevant parts : <<<<< #ifndef IO_BUFFER_SIZE #define IO_BUFFER_SIZE 4096 #endif struct channel { int fd; /* Unix file descriptor */ long offset; /* Absolute position of fd in the file */ char * end; /* Physical end of the buffer */ char * curr; /* Current position in the buffer */ char * max; /* Logical end of the buffer (for input) */ void * mutex; /* Placeholder for mutex (for systhreads) */ char buff[IO_BUFFER_SIZE]; /* The buffer itself */ }; #define Channel(v) (*((struct channel **) (Data_custom_val(v)))) >>>>> Oliv ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr