Re: [polyml] Foreign and cShort

2016-05-25 Thread David Matthews
I've pushed a fix to git. It was getting the sign-extension wrong for cInt16 and hence for cShort. David On 25/05/2016 13:43, David Matthews wrote: Yes, it looks like a bug. I don't think it's sign-extending the result correctly. David On 25/05/2016 13:24, Kostirya wrote: is it error? ca

Re: [polyml] Foreign and cShort

2016-05-25 Thread David Matthews
Yes, it looks like a bug. I don't think it's sign-extending the result correctly. David On 25/05/2016 13:24, Kostirya wrote: is it error? cat foo.c short foo (short x) { return x+1; } clang -shared -o foo.so foo.c cat foo.sml open Foreign; val mylib = loadLibrary "foo.so" fun foo x

[polyml] Foreign and cShort

2016-05-25 Thread Kostirya
is it error? > cat foo.c short foo (short x) { return x+1; } > clang -shared -o foo.so foo.c > cat foo.sml open Foreign; val mylib = loadLibrary "foo.so" fun foo x = buildCall1 ((getSymbol mylib "foo"), cShort, cShort) x val r = foo ~5 val _ = print ( (Int.toString r) ^ "\n" ) > env LD_LIBRARY