[MLton] WideChar

Stephen Weeks MLton@mlton.org
Fri, 10 Dec 2004 18:40:08 -0800


> There seems to be a problem here, since I think in C, "char" can be
> either "signed char" or "unsigned char".
...
> I'm pretty sure that x86 defaults to signed char, while PowerPC defaults
> to unsigned char.

Hmm.  MLton runs on PowerPC with no problems.  We did have problems
initially on PowerPC when we mapped SML char to C unsigned char.  This
led us to add some infrastructure to be more careful about the
distinction.  Once we got SML char mapped to C signed char, we were
fine.  

> Is this accounted for in the MLton FFI?

Nope.  SML char is always C signed char.  This would be easy to change
-- a single line in elaborate-core.fun establishes the correspondence
between SML chars and C chars.  But I'm not sure it's worth changing
until we run into a problematic platform.