Browse thread
[Caml-list] problem with Printf.printf when linking in bytecode interpreter to C app
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | SooHyoung Oh <shoh@m...> |
| Subject: | Re: [Caml-list] problem with Printf.printf when linking in bytecode interpreter to C app |
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" <kmacy@fsmware.com>
To: <caml-list@inria.fr>
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