Rich, Thanks for your reply.
What you mentioned in your blog: In fact saving the AST into the cmo file is relatively simple: we just turn it into a string (using Marshal) and write out the string as a camlp4 substitution: let bitmatch ext2sb = { ... } becomes: let ext2sb = "<string containing marshalled representation of AST>" If I understand correctly, the translated ext2sb would be kept in the same cmo file(where the ext2sb is defined in the extended syntax), rather than an additional (new) cmo file. Currently I'm facing the problem that write a single file in extended syntax, then camlp4 it into two different cmo files. e.g. in extendFile.ml, we define a type t type myextend t = * type definition in my extended syntax * then I want to translate it into: extendFile.cmo: type t = * standard ocaml type definition * module T and some t-related functions and another file newFile.cmo : some functions which doesn't rely on type t, like checking the existence of some files (name mentioned in type t's definition) I know it's possible to generate the latter functions and pretty-print them into newFile.ml, but don't know how to get a compiled cmo file directly. Conglun Conglun On Fri, Oct 17, 2008 at 12:52 PM, Richard Jones <[EMAIL PROTECTED]> wrote: > Camlp4 extensions can open and write files normally. However it > doesn't have access to crucial details of the 'OCaml environment' such > as the current search path for libraries, which means that it usually > cannot do anything sensible. > > For example, I wanted to load another module/library from a camlp4 > extension - but that sort of thing isn't possible as far as I can > tell. > > I wrote a bit more about this issue here: > > http://camltastic.blogspot.com/2008/05/persistent-matches-in-pabitmatch.html > > Rich. > > -- > Richard Jones > Red Hat > _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs