[MLton-user] Conditional compilation
Sean McLaughlin
seanmcl at gmail.com
Sat Nov 29 11:17:40 PST 2008
Hello,
This is a feature request. Or at least a request for a discussion.
I have a fairly large (for a single person) software project that
does a number of related tasks. Many of these tasks are considerably
improved by using external C packages for which I wrote ffi code. Now
that others are trying to compile the software, I have a problem. If
they don't have the relevant C library, for instance CPLEX, a
proprietary linear programming solver, the code won't compile. Now,
the code using CPLEX may never be needed by a particular user, or they
may be equally well served by using a free alternative such as GLPK,
for which I also have ffi stubs.
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
supported some kind of preprocessing directives, as you do for the
single variable SMLNJ_VERSION. According to http://mlton.org/CompilationManager
, no other symbols are defined.
If only I could define my own symbols, I'd be able to avoid the gcc
step, which would be a considerable
improvement. Would it be very difficult to allow a user to define his
own preprocessing variables?
Thanks,
Sean
More information about the MLton-user
mailing list