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 AAA29993; Wed, 22 Sep 2004 00:06:31 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA29058 for ; Wed, 22 Sep 2004 00:06:30 +0200 (MET DST) Received: from ms-smtp-04-eri0.ohiordc.rr.com (ms-smtp-04-smtplb.ohiordc.rr.com [65.24.5.138]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8LM6Tr4018322 for ; Wed, 22 Sep 2004 00:06:30 +0200 Received: from jhome.cowgar.com (a1-1e112.neo.lrun.com [24.93.164.112] (may be forged)) by ms-smtp-04-eri0.ohiordc.rr.com (8.12.10/8.12.7) with ESMTP id i8LM6QIZ012978 for ; Tue, 21 Sep 2004 18:06:27 -0400 (EDT) To: OCaml Mailing List Subject: [Caml-list] Returning a file handle from C (fopen) From: Jeremy Cowgar Date: Tue, 21 Sep 2004 18:06:20 -0400 Message-ID: <87k6un5lb7.fsf@jhome.cowgar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Miltered: at concorde with ID 4150A5E5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; val:01 alloc:01 descriptor:01 compiles:01 alloc:01 descriptor:01 printf:01 fprintf:01 jeremy:01 jeremy:01 ocaml:01 ocaml:01 caml:01 caml:01 implicit:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Greetings, I am trying to return a file handle from C. A simple Val_long does not work, so I did some research and found something like the following: return caml_alloc_channel(caml_open_descriptor_out(myhandle)); This compiles (with 2 warnings): warning: implicit declaration of function `caml_alloc_channel' warning: implicit declaration of function `caml_open_descriptor_out' However, the functions should be avaliable once running in ocaml, no? Anyway, my real problem lies in the fact that when I do something like: let fh = get_my_out_handle () in Printf.fprintf fh "Hello, World!\n";; nothing appears in my output file. No warning, errors or anything. In my C source, I can do the exact thing and the contents are written. Can anyone help me return a file handle from C to OCaml that can be used with the OCaml output/input functions? I do realize a different type would have to be returned for input/output. I was working on the output portion first. Thanks, Jeremy Cowgar ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners