The blob access functions are similar to the atom accessing functions. Blobs being atoms, the atom functions operate on blobs and vice versa. For clarity and possible future compatibility issues, however, it is not advised to rely on this.
- int PL_is_blob(term_t t, PL_blob_t **type)
- Succeeds if t refers to a blob, in which case type is filled with the type of the blob.
- int PL_unify_blob(term_t t, void *blob, size_t len, PL_blob_t *type)
- Unify t to a new blob constructed from the given data and associated to the given type. See also PL_unify_atom_nchars().
- int PL_put_blob(term_t t, void *blob, size_t len, PL_blob_t *type)
- Store the described blob in t. The return value indicates
whether a new blob was allocated (
FALSE) or the blob is a reference to an existing blob (
TRUE). Reporting new/existing can be used to deal with external objects having their own reference counts. If the return is
TRUEthis reference count must be incremented, and it must be decremented on blob destruction callback. See also PL_put_atom_nchars().
- int PL_get_blob(term_t t, void **blob, size_t *len, PL_blob_t **type)
- If t holds a blob or atom, get the data and type and return
TRUE. Otherwise return
FALSE. Each result pointer may be
NULL, in which case the requested information is ignored.
- void * PL_blob_data(atom_t a, size_t *len, PL_blob_t **type)
- Get the data and type associated to a blob. This function is mainly used from the callback functions described in section 126.96.36.199.