Re: [m-users.] Passing blobs over the foreign lanuage interface
"Zoltan Somogyi" <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
2023-02-12 00:29 GMT+11:00 "Volker Wysk" <[email protected]>: > 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 _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users