#include <stdbool.h>
#include <stddef.h>
#include <lbm_types.h>
#include <lbm_defines.h>
#include <heap.h>
Go to the source code of this file.
|
#define | CUSTOM_TYPE_VALUE 0 |
|
#define | CUSTOM_TYPE_DESCRIPTOR 1 |
|
#define | CUSTOM_TYPE_DESTRUCTOR 2 |
|
#define | CUSTOM_TYPE_LBM_MEM_SIZE 3 |
|
|
typedef bool(* | custom_type_destructor) (lbm_uint) |
|
◆ lbm_custom_type_create()
bool lbm_custom_type_create |
( |
lbm_uint |
value, |
|
|
custom_type_destructor |
fptr, |
|
|
const char * |
desc, |
|
|
lbm_value * |
result |
|
) |
| |
Create a value of a custom type with a destructor and a description
- Parameters
-
value | The custom value. This can be a pointer to memory allocated on the C-side. |
fptr | The destructor function. This function should free any memory allocated on the C-side. |
desc | A description of the type that will be used for printing. |
result | Pointer to lbm_value that will hold the value of the custom type. |
- Returns
- true on success or false otherwise.
◆ lbm_custom_type_destroy()
bool lbm_custom_type_destroy |
( |
lbm_uint * |
lbm_mem_ptr | ) |
|
Called by garbage collector and invokes the destructor on the custom value.
/return true on success or false otherwise.