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?

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_PATH=. poly --script foo.sml
65532

P.S.
Polyml is from git 5 days ago.



_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to