[MLton] Representation of strings in the FFI
Stephen Weeks
MLton@mlton.org
Wed, 27 Apr 2005 16:08:53 -0700
> I take it, I should use GC_arrayNumElementsp at the C level.
>
> /* The array size is stored before the header */
> static inline uint* GC_arrayNumElementsp (pointer a) {
...
> static inline int GC_arrayNumElements (pointer a) {
Yes, you can use either of these. Although you could use the same
trick I just mentioned too, with the drawback that only monomorphic
values may be exported
val _ = _export "intArrayLength": int array -> int;
Array.length