[MLton] MLton broken FFI on AMD64???

Henry Cejtin henry.cejtin at sbcglobal.net
Fri Feb 4 07:49:26 PST 2011


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 <wesley at terpstra.ca>
To: Henry Cejtin <henry.cejtin at sbcglobal.net>
Cc: mlton at mlton.org
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 <henry.cejtin at sbcglobal.net> 
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20110204/65a64caf/attachment.htm


More information about the MLton mailing list