Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "SooHyoung Oh" <shoh@miritek.com>
To: "Kip Macy" <kmacy@fsmware.com>, <caml-list@inria.fr>
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	[thread overview]
Message-ID: <002501c3e3c8$cccd0b20$1501a8c0@hama> (raw)
In-Reply-To: <20040125193722.J53910@demos.bsdclusters.com>

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


  reply	other threads:[~2004-01-26  4:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-26  3:42 Kip Macy
2004-01-26  4:56 ` SooHyoung Oh [this message]
2004-01-26  5:52   ` Kip Macy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002501c3e3c8$cccd0b20$1501a8c0@hama' \
    --to=shoh@miritek.com \
    --cc=caml-list@inria.fr \
    --cc=kmacy@fsmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox