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] pa_macro to substitute a constant?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: [Caml-list] pa_macro to substitute a constant?

How can I use pa_macro to substitute in a constant into a program?

A real example:

Makefile ------------------------------------------------------------

VERSION = 1.0.0

version.cmo: Makefile
	ocamlc -I +camlp4 -pp 'camlp4o pa_macro.cmo -DPACKAGE="$(PACKAGE)" -DVERSION="$(VERSION)"' $< -o $@ ----------------------------------------------------------

let package = PACKAGE
let version = VERSION


Needless to say this example doesn't work, and looking at the thin
documentation for pa_macro, I'm not even sure it's possible.  Is it?


Richard Jones.
Merjis Ltd. - improving website return on investment
MONOLITH is an advanced framework for writing web applications in C, easier
than using Perl & Java, much faster and smaller, reusable widget-based arch,
database-backed, discussion, chat, calendaring: