Le Thu, 1 Mar 2012 20:58:38 +0100,
Thomas Gazagnaire <thomas.gazagna...@gmail.com> a écrit :

> ocamlc dynlink.cma unix.cma \
>        -I +camlp4 camlp4lib.cma -linkall \
>        Camlp4Parsers/Camlp4OCamlRevisedParser.cmo \
>        Camlp4Parsers/Camlp4OCamlParser.cmo \
>        Camlp4Parsers/Camlp4OCamlRevisedParserParser.cmo \
>        Camlp4Parsers/Camlp4OCamlParserParser.cmo \
>        Camlp4Printers/Camlp4AutoPrinter.cmo \
>        Camlp4Bin.cmo \
>        -I +site-lib/type-conv pa_type_conv.cma \
>        -I +site-lib/sexplib pa_sexp_conv.cma \
>        -o sexppp
>
> I've taken the first lines by greping camlp4o.native in
> ocaml-3.12.1/_build/_log and I've appended what normally follows
> camlp4o when using sexplib.
> 
> The command succeeds at building sexppp, but unfortunately, the
> preprocessor doesn't work as expected: "./my_pp foo.ml" gives: "Parse
> error: [semi] expected after [str_item] (in [implem])" for any type
> followed by "with sexp" in foo.ml.
> 
> I am trying to do something crazy or is there a chance to make it
> work?

It is because Camlp4Bin.cmo is linked before pa_type_conv.cma and
pa_sexp_conv.cma, and so side-effects of theses modules are not
yet performed when the camlp4 main function run.

Camlp4Bin.cmo must be the last file on the command line.

Cheers,

-- 
Jérémie


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to