[MLton] Problem with MinGW

Wesley W.Terpstra wesley@terpstra.ca
Mon, 29 May 2006 01:57:51 +0200


I've been stuck on this for a while now, so thought it time to ask  
for some backup. :-) Everything about MLton seems to work on MinGW  
now, except opening files from programs compiled by the fresh  
compiler. It always fails with EINVAL. Otherwise, the regressions  
pass (with the stage 1 compiler; the stage 2 doesn't work as it can't  
open files).

I've put in test code around the Posix_FileSys_open3 method and  
confirmed that it is indeed getting correct parameters and is failing  
with EINVAL. I've also tried linking a custom C program against the  
runtime and calling this method with the same parameters. Then it works.

Unfortunately, there doesn't seem to be an 'strace' for windows (I  
found one, but it doesn't work with MLton compiled programs), so I  
can't figure out why the system call is failing. I suspect an earlier  
system call somehow tainted things, but I can't see what happened  
earlier... gdb fails to debug the assembler section, and the c- 
codegen doesn't compile on MinGW.

Any suggestions about how I could debug this? A switch to the effect  
of 'print all FFI calls to stderr' would be very helpful. The only  
thing I can think of at the moment is to try to fix the c-codegen so  
that I can use gdb.