From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA19100; Tue, 18 Sep 2001 09:50:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA19040 for caml-list@pauillac.inria.fr; Tue, 18 Sep 2001 09:50:27 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id GAA16953 for ; Tue, 18 Sep 2001 06:02:30 +0200 (MET DST) Received: from web10102.mail.yahoo.com (web10102.mail.yahoo.com [216.136.130.52]) by concorde.inria.fr (8.11.1/8.10.0) with SMTP id f8I42S923008 for ; Tue, 18 Sep 2001 06:02:29 +0200 (MET DST) Message-ID: <20010918040228.8243.qmail@web10102.mail.yahoo.com> Received: from [64.130.152.21] by web10102.mail.yahoo.com via HTTP; Mon, 17 Sep 2001 21:02:28 PDT Date: Mon, 17 Sep 2001 21:02:28 -0700 (PDT) From: Gao katie Subject: [Caml-list] newbie question: How to do conditional compilation? To: caml-list@inria.fr MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-89947531-1000785748=:7979" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --0-89947531-1000785748=:7979 Content-Type: text/plain; charset=us-ascii Can anyone tell me how to do conditional compilation in Ocaml? #ifdef DEBUG ... #else ... #endif Thanks. --------------------------------- Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information inYahoo! News. --0-89947531-1000785748=:7979 Content-Type: text/html; charset=us-ascii

Can anyone tell me how to do conditional compilation in Ocaml?

#ifdef DEBUG

...

#else

...

#endif

Thanks.

 



Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information in Yahoo! News. --0-89947531-1000785748=:7979-- ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA19644; Tue, 18 Sep 2001 10:06:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA20032 for ; Tue, 18 Sep 2001 10:06:30 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8I86R927600; Tue, 18 Sep 2001 10:06:27 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id KAA22965; Tue, 18 Sep 2001 10:06:27 +0200 Date: Tue, 18 Sep 2001 10:06:27 +0200 From: Daniel de Rauglaudre To: Gao katie Cc: caml-list@inria.fr Subject: Re: [Caml-list] newbie question: How to do conditional compilation? Message-ID: <20010918100627.C22805@verdot.inria.fr> References: <20010918040228.8243.qmail@web10102.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010918040228.8243.qmail@web10102.mail.yahoo.com>; from katiegao@yahoo.com on Mon, Sep 17, 2001 at 09:02:28PM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Mon, Sep 17, 2001 at 09:02:28PM -0700, Gao katie wrote: > Can anyone tell me how to do conditional compilation in Ocaml? > #ifdef DEBUG > ... > #else > ... > #endif 1/ You can use camlp4. Compile either with ocamlc -pp "camlp4o pa_ifdef.cmo" or with ocamlc -pp "camlp4o pa_ifdef.cmo -DDEBUG" In your code, you can then use "ifdef DEBUG ... else ... end" in position of expression, or "ifdef ... end" in position of structure item (toplevel phrase, if you prefer). You can also use "define" (but without parameters: "define DEBUG", not "define DEBUG xxx") 2/ Another solution is to use /lib/cpp, the C preprocessor. I think that you can use it in only one command with the ocamlc parameter -pp: ocamlc -pp "/lib/cpp" ocamlc -pp "/lib/cpp -DDEBUG" -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr