Re: Access to Word8Array.arrayUninit

Kostirya <[email protected]> Wed, 16 Nov 2016 17:32:12 +0200
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <CAG+QnTf7WRPYXLTaju0xqGy0QvXbCZaL-A9yD7f7H1RRSAT9qA@mail.gmail.com>
Yes, Unsafe.Word8Vector.fromArray will be useful for FFI.
Thank you.

2016-11-16 17:10 GMT+02:00 Matthew Fluet <[email protected]>:
> Anything outside of the `$(SML_LIB)/basis/*.mlb` files should be
> considered private implementation details of the Basis Library
> implementation.  They are subject to change in backwards incompatible
> ways.
>
> I suppose that we could add "Unsafe.Word8Vector.fromArray", though it
> is a little more unsafe than the other functions.  Creating an
> uninitialized monomorphic array of numeric type just means that you
> get random bits, but for numeric types, any random bits are valid
> values of the element type.  But, the array to vector conversion is
> implemented as a simple pointer copy and update to the header of the
> object and the compiler relies upon the fact that the code retains no
> references to the array; we ensure that in the Basis Library
> implementation, but it wouldn't be checked for user code.
>
> On Tue, Nov 15, 2016 at 12:44 PM, Kostirya <[email protected]> wrote:
>> I found:
>> $(SML_LIB)/basis/build/sources.mlb must be the last in MLB file.
>> :-)
>>
>> 2016-11-15 9:39 GMT+02:00 Kostirya <[email protected]>:
>>> Now I am curious how Socket structure have access to
>>> Word8Vector.unsafeFromArray and Word8Array.arrayUninit.
>>> What MLB file is responsible for this?
>>> It is a mystery to me...
>>>
>>> 2016-11-14 19:23 GMT+02:00 Matthew Fluet <[email protected]>:
>>>> You can use "$(SML_LIB)/basis/unsafe.mlb" to access the Unsafe
>>>> structure: http://mlton.org/UnsafeStructure.  You should be able to
>>>> use "Unsafe.Word8Array.create" to create an uninitialized array.
>>>>
>>>>
>>>> On Mon, Nov 14, 2016 at 4:13 AM, Kostirya <[email protected]> wrote:
>>>>> Hello.
>>>>> I use now Primitive.Array.arrayUnsafe for FFI:
>>>>>
>>>>>   val arrayUnsafe = Primitive.Array.arrayUnsafe                  (* 32bit OS *)
>>>>>   val arrayUnsafe = Primitive.Array.arrayUnsafe o Int64.fromInt  (* 64bit OS *)
>>>>>
>>>>> To have one version code for 32bit both 64bit OS I want to use
>>>>> Word8Array.arrayUninit instead Primitive.Array.arrayUnsafe.
>>>>>
>>>>> But I can not access Word8Array.arrayUninit.
>>>>> Please, tell me which mlb file I must plug.
>>>>>
>>>>> 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].
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Developer Access Program for Intel Xeon Phi Processors
>>>>> Access to Intel Xeon Phi processor-based developer platforms.
>>>>> With one year of Intel Parallel Studio XE.
>>>>> Training and support from Colfax.
>>>>> Order your platform today. http://sdm.link/xeonphi
>>>>> _______________________________________________
>>>>> MLton-user mailing list
>>>>> [email protected]; [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/mlton-user
>>>>
>>>> --
>>>> 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].
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> MLton-user mailing list
>>>> [email protected]; [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/mlton-user
>>
>> --
>> 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].
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> MLton-user mailing list
>> [email protected]; [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mlton-user
>
> --
> 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].
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> MLton-user mailing list
> [email protected]; [email protected]
> https://lists.sourceforge.net/lists/listinfo/mlton-user

-- 
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].


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