[MLton-user] FFI and pointer relocation
dherman at ccs.neu.edu
Mon Nov 26 13:49:52 PST 2007
> GC may move the ref cell. As a rule of thumb (unless you really know
> what you are doing), any data you wish to modify on the C side should
> be allocated from the C heap. If you wish this stuff to work from
> both SML/NJ and MLton, I recommend that you use ML-NLFFI (the learning
> curve is a bit steep, but it works).
Yeah, I've briefly played with ML-NLFFI before but MLton's native FFI is
so easy to use that I've stuck with that for now.
For now I'll just allocate the cell in C and export a C function to
check if the cell has changed.
> If you need help with ML-NLFFI, please post the C API (necessary
> function prototypes and type (forward) declarations) to the list, and
> someone (probably me) can prepare a sample (of how to use ML-NLFFI)
> and post it to the list.
I may do this in the future but I'm afraid I don't really have time to
play with ML-NLFFI at the moment.
Thanks as always for the help!
More information about the MLton-user