From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 14C7BBBAF for ; Tue, 23 Mar 2010 06:50:24 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjUBAGfzp0tCbwQakWdsb2JhbACbKBUBAQEBCQsKBxMEHrtDBYR9gyI X-IronPort-AV: E=Sophos;i="4.51,292,1267398000"; d="scan'208";a="59532570" Received: from out2.smtp.messagingengine.com ([66.111.4.26]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 23 Mar 2010 06:50:23 +0100 Received: from compute2.internal (compute2.internal [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id 8B554E9EB5; Tue, 23 Mar 2010 01:50:21 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Tue, 23 Mar 2010 01:50:21 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=BxQA7IdnL0DhH7m7IbZBXxphhec=; b=TEzoyV2ZjkC4pHNA3b113B3Xu5XJwQ1f0EJ8C+HgKgeIDiNI6FgRIdhkyzwaVBsbwIjAufmNIYNLXk4qU+AIxUqtjS88N5QYW5JK7+QrTgIu77gxse6752V455ge6ID6DhWhfTU+KySSdciefAkqM/SIsyEKD4frj4urjoXJ568= X-Sasl-enc: W5iaIY1vqRqH0QOUQwssz8EjSejYgfOeOT40msZ+rdZT 1269323421 Received: from [192.168.2.4] (c-98-248-33-155.hsd1.ca.comcast.net [98.248.33.155]) by mail.messagingengine.com (Postfix) with ESMTPSA id 04FC04B1A49; Tue, 23 Mar 2010 01:50:20 -0400 (EDT) Message-ID: <4BA8569B.9030803@ens-lyon.org> Date: Mon, 22 Mar 2010 22:50:19 -0700 From: Martin Jambon User-Agent: Thunderbird 2.0.0.22 (X11/20090908) MIME-Version: 1.0 To: kgo@grant-olson.net Cc: caml-list@inria.fr Subject: Re: [Caml-list] Building multiple configurations? References: <4BA80CB5.4080402@grant-olson.net> In-Reply-To: <4BA80CB5.4080402@grant-olson.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ens-lyon:01 runtime:01 ifdef:01 ifdef:01 ocaml:01 config:01 wrote:01 compile:01 preprocessor:01 caml-list:01 jambon:01 jambon:01 implemented:02 advertising:92 i'm:09 Grant Olson wrote: > I'm doing something weird here and I'm thinking there has to be a better > way. > > I've got a configuration file that's a .ml file. And I do want it to be > an .ml file that gets included at compile time, not some .txt config > file that gets read in at runtime. I'm building two different versions > of my app, with two different configurations. > > Basically, I want to do the same thing as a C #ifdef: > > #ifdef VERSION2 > ... include version one > #else > ... include version two > #endif I implemented a "C preprocessor" for OCaml called cppo that lets you do that. It may not be the best choice here but I think it's worth some advertising: http://martin.jambon.free.fr/cppo.html Martin -- http://mjambon.com/