English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Toplevel with camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-03-27 (01:54)
From: Andre Nathan <andre@s...>
Subject: Toplevel with camlp4

I have the simple program below:

  let () =
    Sys.interactive := false;
    Toploop.initialize_toplevel_env ();
    for i = 1 to (Array.length Sys.argv) - 1 do
      ignore (Toploop.use_file Format.std_formatter Sys.argv.(0))

which works fine when compiled with

  $ ocamlc -o a toplevellib.cma a.ml

and run as

  $ ./a foo.ml bar.ml
  val a : int = 1
  val b : int = 2

Both files are processed correctly. However, if I add camlp4 to the
compilation options, as in

  $ ocamlc -o a toplevellib.cma -I +camlp4 camlp4o.cma a.ml

the first file is processed, but then I get a bad file descriptor error
for the second one:

  $ ./a foo.ml bar.ml                                      
  val a : int = 1
  I/O error: Bad file descriptor

Does anyone know what could be going on here?