To make MLton work with files bigger than 2 gigabytes, you have to compile all the C code with the following command line argument: -D_FILE_OFFSET_BITS=64 or you can add the line #define _FILE_OFFSET_BITS 64 but it must occur BEFORE you #include anything. This will change the definition of various types from int's to long long's. This changes the result and 2nd argument of lseek for instance.