Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] [camlp4] compiling against Pcaml module
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stefano Zacchiroli <zack@c...>
Subject: [Caml-list] [camlp4] compiling against Pcaml module
I'm trying to play with ocaml sources abstract syntax tree, but I'm
unable to compile against Pcaml module.

As camlp4 reference manual report at the beginning of chapter 8:

  When linking an application using this library modules, you have to
  add the file gramlib.cma in the command line. For example, with the
  line:
          ocamlc -I +camlp4 gramlib.cma <the_files> 

This seems to work with modules from camlp4 library modules other that
Pcaml (try for example with Fstream or Stdpp).

As an example I've tried to build the following source file:

   (* bar.ml *)
   let ast =
     !Pcaml.parse_interf (Stream.of_channel (open_in "foo.mli"))
   in
     print_endline "foo"

with the following command:

  ocamlc -o bar -I +camlp4 gramlib.cma bar.ml

and I get:

  Error while linking ast_prova.cmo: Reference to undefined global `Pcaml'

I've also digged into <stdlib>/camlp4/gramlib.a with 'nm' and indeed I
found no symbols starting with "Pcaml" string.
Unfortunately the stdlib directory contains also no pcaml.cmo object ..

What I've to link additionally to gramlib.cma in order to use "Pcaml"
module?

BTW, is probably better also to correct the camlp4 manual with the
appropriate compile line, if I haven't missed something though.

TIA,
Cheers.

-- 
Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy
zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro
"I know you believe you understood what you think I said, but I am not
sure you realize that what you heard is not what I meant!" -- G.Romney
-------------------
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