Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-10-17 (16:09)
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
          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:

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

with the following command:

  ocamlc -o bar -I +camlp4 gramlib.cma

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"

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


Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy | ICQ# 33538863 |
"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 Archives:
Bug reports: FAQ:
Beginner's list: