[MLton-user] Conditional compilation

Ville Laurikari ville at laurikari.net
Sat Nov 29 22:42:51 PST 2008


On Sat, Nov 29, 2008 at 02:17:40PM -0500, Sean McLaughlin wrote:
>   My current solution is to use #include a file that has the names of
> the relevant libraries, and each of my
> mlb files are preprocessed using cpp to generate the actual mlb file
> that will be compiled.  This is a somewhat ugly solution.  If MLton

The usual way to deal with this is to use MLB path variables.  The
path map file can be set with -mlb-path-map.  With recent MLton
versions, you can also set individual path variables with
-mlb-path-var.

In your case, you should divide the different variants of linear
programming support (none, cplex, glpk) into separate libraries which
all export the same interface.  These could be, for example, in a
layout like this:

   lp/none.mlb
   lp/cplex.mlb
   lp/glpk.mlb

Then you can define a path variable, say LP, to choose the appropriate
linear programming library for your application:

   lp/$(LP).mlb


--
Ville



More information about the MLton-user mailing list