[MLton-user] NLFFI incompatibility with SML/NJ?

Matthew Fluet fluet at tti-c.org
Sun Feb 25 11:38:44 PST 2007


Adam Chlipala wrote:
> I've had great success using the NLFFI with both MLton and SML/NJ in the 
> development of an OpenSSL binding.  However, there's one nagging 
> difference that I've found in the typing of the automatically-generated 
> signatures, forcing me to create my own tiny "compatibility" signature 
> that has different implementations for the different compilers.
> 
> The example I've come across so far has to do with the return type of, 
> for instance, C.Get.uchar'.  In SML/NJ, the right WORD structure to use to
> manipulate these values is Word32.  In MLton, it seems to be 
> MLRep.Char.Unsigned.

In SML/NJ, it is MLRep.Unsigned, which is equal to Word32.
In MLton, it is MLRep.Char.Unsigned, which is equal to Word8.

I chose to give MLton's implementation more accurate structures/types, 
since we supported the smaller and larger sized integer, words, and floats.

> Have I missed a common alias for these structures that works in both 
> MLton and SML/NJ?

No.  It is a compatability difference, mentioned at:
   http://www.mlton.org/MLNLFFIImplementation




More information about the MLton-user mailing list