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
Building multiple configurations?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yoann Padioleau <padator@w...>
Subject: Re: [Caml-list] Building multiple configurations?

On Mar 22, 2010, at 5:35 PM, 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.

Why ? Why ? Why not having your app configurable with a txt file
or some command line flags like every other programs ?

> Basically, I want to do the same thing as a C #ifdef:
> #ifdef VERSION2
>   ... include version one
> #else
>   ... include version two
> #endif

People use that because they want to do different things depending on the architecture, or
if some dependencies are present or not. Do you have the same requirement here ?

> And then the two different builds link in two different object files
> that have the same interface, creating the two different versions of the
> app.
> At first I thought I could write out the "module" and "module type"
> stuff manually, giving the same module name in two differently named
> files.  But this of course creates a sub-module that isn't bound to the
> right namespace, and linking fails.
> What I'm doing now is using the -impl flag.  I've got two files:
>, and config.alt.  The second version builds with "-impl
> config.alt" in the list of files passed to ocamlopt instead of ""
> This works, but it just seems wrong.  Is there a better way for me to do
> this?
> -Grant
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: