Re: FFI callback is broken in last git version

Phil Clayton <[email protected]> Wed, 28 Sep 2016 09:24:26 +0100
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <[email protected]>
Does it work if you specify the attribute 'reentrant'?  See previous 
discussion
https://sourceforge.net/p/mlton/mailman/message/34497352/
and
http://mlton.org/ForeignFunctionInterfaceSyntax

Regards,
Phil

On 28/09/2016 04:27, Kostirya wrote:
> Hello.
> I updated MLton from git repository and detect what FFI callback is broken.
>
>> mlton
> MLton gd201ca9-dirty (built Tue Sep 27 15:21:50 EEST 2016 on thinkpad)
>
>
>> cat callback.c
> void foo ( int n, void (*fn) (int) ) {
>         int i = 1;
>         while (n--) {
>                 (*fn)(i++);
>         }
>         return;
> }
>
>
>> cat cb-mlton.sml
> val foo = _import "foo" public: int * MLton.Pointer.t -> unit;
> val () = (_export "cb" : (int -> unit) -> unit;) (fn v => print
> ((Int.toString v) ^ "\n"))
> val cb = _address "cb" public: MLton.Pointer.t;
> val _ = foo(3, cb)
>
>> mlton -default-ann 'allowFFI true' cb-mlton.sml callback.c
>
>> ./cb-mlton
> Segmentation fault(core dumped)
>
> Previous version (MLton 20130715) is worked.
>
> Best regards, Nick.
>
> --
> You received this message because you are subscribed to the Google
> Groups "MLton-user" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> MLton-user mailing list
> [email protected]; [email protected]
> https://lists.sourceforge.net/lists/listinfo/mlton-user
>


------------------------------------------------------------------------------