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 FAA02933; Mon, 26 Jan 2004 05:58:53 +0100 (MET) 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 FAA03284 for ; Mon, 26 Jan 2004 05:58:52 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from miritek.com (miritek.com [210.107.136.75]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i0Q4wov21300 for ; Mon, 26 Jan 2004 05:58:51 +0100 (MET) Received: from hama (v36-99.icu.ac.kr [210.107.136.99]) by miritek.com (8.9.3/8.9.3) with SMTP id OAA02742; Mon, 26 Jan 2004 14:09:49 +0900 Message-ID: <002501c3e3c8$cccd0b20$1501a8c0@hama> From: "SooHyoung Oh" To: "Kip Macy" , References: <20040125193722.J53910@demos.bsdclusters.com> Subject: Re: [Caml-list] problem with Printf.printf when linking in bytecode interpreter to C app Date: Mon, 26 Jan 2004 13:56:15 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 printf:01 printf:01 buffer:01 stdout:01 stdout:01 foo:01 kip:99 caml-list:01 2004:99 runtime:01 foo:01 callback:01 callback:01 argv:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk It seems that the output buffer is not flushed. Use "flush stdout" after Printf.printf. For example, let _ = Printf.printf "ocaml inited\n"; flush stdout let foo () = Printf.printf "this works\n"; flush stdout --- SooHyoung Oh ----- Original Message ----- From: "Kip Macy" To: Sent: Monday, January 26, 2004 12:42 PM Subject: [Caml-list] problem with Printf.printf when linking in bytecode interpreter to C app > I've linked the ocaml runtime into my application: > this is my ocaml.ml: > let _ = Printf.printf "ocaml inited\n" > > let foo () = Printf.printf "this works\n" > > > let rec fib n = if n < 2 then 1 else fib(n-1) + fib(n-2) > > let _ = Callback.register "foo" foo > > let _ = Callback.register "fib" fib > > > This is the relevant C code: > printf("calling caml_startup\n"); > caml_startup(argv); > callback(*caml_named_value("foo"), Val_unit); > result = Int_val(callback(*caml_named_value("fib"), Val_int(6))); > printf("the result of fib is %d\n", result); > > > The only output I get is: > calling caml_startup > the result of fib is 13 > > Why don't the Printf.printf statements output anything? > > > Thanks. > > -Kip > > ------------------- > 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 > > ------------------- 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