[m-users.] Passing blobs over the foreign lanuage interface

Volker Wysk post at volker-wysk.de
Sun Feb 12 00:57:27 AEDT 2023


Am Sonntag, dem 12.02.2023 um 00:48 +1100 schrieb Zoltan Somogyi:
> 2023-02-12 00:29 GMT+11:00 "Volker Wysk" <post at volker-wysk.de>:
> > The right type for a BLOB should be array(uint8).
> 
> Logically, a blob corresponds only to the *items* in an array(uint8).
> An actual array(uint8) consists of the items *and* the array size.
> There is also the issue that Mercury's array type constructor,
> being generic, reserves a word of memory for each item.
> Not only is this overkill when the items are uint8s, it also means
> that the uint8s are not next to each other, which contradicts the
> usual definition of a "blob".
> 
> The Mercury standard library module that most closely matches
> a blob is the bitmap module, though it is more general, as it can also
> represent a bit sequence whose length is not a multiple of 8.
> Have a look. Note that its C interface is not in the manual either,
> but if you have a look at runtime/mercury_types.h and its definition
> of MR_BitmapPtr, you should learn all you need to know.
> 
> The

Thanks for the fast answer. But it seems like it has been cropped?

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20230211/283bd8e9/attachment.sig>


More information about the users mailing list