Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Andre Nathan <andre@s...>
Subject: Toplevel with camlp4
Hello

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))
    done

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?

Thanks,
Andre