Hi, Thank you for narrowing the error down. It should now be fixed.
There were a lot of cases where code that worked correctly on the native address versions failed in the 32-in-64 version and had to be modified. I'm sure there are still some cases that haven't been tested.
Regards, David
On 24/01/2019 08:08, Kostirya wrote:
Hello. I localized the error finally. Whew! Yes, it is *only* on 32-in-64 and it is reproducible with 100% on FreeBSD and CentOS. I prepared simple code for reproduce the error. It is FFI callback.
cat callback.c
void foo ( int n, void (*fn) (int) ) { int i = 1; while (n--) { (*fn)(i++); } return; }
cat cb-poly.sml
open Foreign val mylib = loadLibrary "callback.so" val foo = buildCall2 ((getSymbol mylib "foo"), (cInt, cFunction), cVoid) val cb = buildClosure1 ((fn v => print ((Int.toString v) ^ "\n")), cInt, cVoid) val _ = foo(3, cb)
cc -shared -o callback.so callback.c