[MLton] Re: mingw and solaris

Bernard Berthomieu Bernard.Berthomieu at laas.fr
Tue Dec 18 06:11:44 PST 2007


Hello,

Matthew Fluet wrote:
>
> [Moving from mlton-user to mlton.]
>
> On Mon, 17 Dec 2007, Bernard Berthomieu wrote:
>> With the current mlton sources, you also need to patch files 
>> runtime/platform/mingw.(h|c)
>> as follows:
>>   in runtime/platform/mingw.h : remove declarations of timezone and 
>> gettimeofday
>>   in runtime/platform/mingw.c : modify the type of the second 
>> parameter of gettimeofday to (void *)
> What version of MinGW/MSYS requires these changes?  Is there a simple 
> way to support both the older version of MinGW and the newer?
The current version of mingw (msys 1.0, with either gcc 3.4.5 or gcc 
4.2.1) defines timezone
and gettimeofday in /mingw/include/sys/time.h, which is included by 
runtime/platform/mingw.h.
Older versions of mingw didn't. I don't know since when though, but 
there is a copy of
a 2004 mingw on my machine, that do not define these.

So, to use mlton with the latest mingw, one must apply at least the 
first patch above.
About the second patch, needed to recompile mlton, there in an 
enlightening comment
in file include/sys/time.h of my station:
   
/*
 * gettimeofday() and settimeofday() were included in SVr4 due to their
 * common use in BSD based applications.  They were to be included exactly
 * as in BSD, with two parameters.  However, AT&T/USL noted that the second
 * parameter was unused and deleted it, thereby making a routine included
 * for compatibility, incompatible.
 *
 * XSH4.2 (spec 1170) defines gettimeofday and settimeofday to have two
 * parameters.
 *
 * This has caused general disagreement in the application community as to
 * the syntax of these routines.  Solaris defaults to the XSH4.2 definition.
 * The flag _SVID_GETTOD may be used to force the SVID version.
 */

The mingw headers define gettimeofday with two parameters, the second
with type (void *), as would do most contemporary unixes, I guess.

For future releases: If gettimeofday is kept in runtime/platform/mingw.c,
then I think it should be modified to fit the mingw profile. Now, if mingw
provides gettimeofday (it does in libmingwex.a, as Wesley mentioned) and
if it works, why not using the mingw version of gettimeofday rather than
redefining it ?  I'll try this.

> I could also recompile mlton 20070826 on a x86-solaris station, from 
> Scott's port and
>
> One difficulty with Scott's patch is that it doesn't gracefully handle 
> both Solaris 10 and previous versions of Solaris.  There was a patch 
> to support Solaris 7 applied less than a year ago, so older versions 
> are still being used, and I'm not sure that we should drop support for 
> them. Nonetheless, Solaris 10 seems to be significantly more 
> POSIX/SUSv3 compliant, which makes it a nicer platform to target.
There have been major changes between Solaris 9 and 10 (no more static 
system
libraries in Sol 10, for instance, among many others).  Probably because 
of this,
many Solaris users did not switch yet to version 10. Compatibility with 
both (7-9 and 10)
should thus be preserved for a while.

> I mention both of these issues with supporting multiple versions of a 
> platform, because I'm not sure that our current mechanisms for doing 
> so are going to continue to scale.
  Bernard.




More information about the MLton mailing list