Re: MLton broken FFI on AMD64???
Henry Cejtin <[email protected]>
| Newsgroups | gmane.comp.lang.ml.mlton.devel |
|---|---|
| Message-ID | <[email protected]> |
Sorry for the confusion, the strings were null terminated but a
backslash got lost in the mail. The actual program was:
val printf = _import "printf": string * int -> unit;
val () = printf ("You are a dog %d\n\000", 99)
val () = printf ("Hello silly %d\n\000", 123)
________________________________
From: Wesley W. Terpstra <[email protected]>
To: Henry Cejtin <[email protected]>
Cc: [email protected]
Sent: Fri, February 4, 2011 2:32:00 AM
Subject: Re: [MLton] MLton broken FFI on AMD64???
On Thu, Feb 3, 2011 at 11:46 PM, Henry Cejtin <[email protected]>
wrote:
The following program segfaults when run:
>
> val printf = _import "printf": string * int -> unit;
> val () = printf ("You are a dog %d0000", 99)
> val () = printf ("Hello silly %d0000", 123)
>
My first answer was: null terminate your string.
However, the segfault persists. If you replace "printf" with "test":
void test(const char* s, int x) {
printf(s, x);
}
... it works.
The problem also only appears for me when I target amd64. i386 works.
_______________________________________________
MLton mailing list
[email protected]
http://mlton.org/mailman/listinfo/mlton