file module.ml:
let func x = print_endline x

  file pa.ml:
open Camlp4.PreCast
open Module
module Id = struct
  let name = "pa"
  let version = "0.01"
end
module Make (Syntax : Camlp4.Sig.Camlp4Syntax) = struct
  include Syntax
  EXTEND Gram
    GLOBAL: expr;
    expr: [ [ "Hello" -> Module.func "Hello world!"; <:expr< >>  ] ];
  END
end
module M = Camlp4.Register.OCamlSyntaxExtension(Id)(Make)

  file test.ml:
open Module
Hello

  building:
$ ocamlc -c module.ml
$ ocamlc -c -pp "camlp4of" -I /usr/lib/ocaml/3.11.0/camlp4 module.cmo pa.ml
$ ocamlc -c -pp "camlp4of pa.cmo" -I /usr/lib/ocaml/3.11.0/camlp4 module.cmo test.ml
Camlp4: Uncaught exception: DynLoader.Error ("./pa.cmo", "error while linking ./pa.cmo.
Reference to undefined global `Module&#039;")

File "test.ml", line 1, characters 0-1:
Error: Preprocessor error

Add a code snippet to your website: www.paste.org