@@ -114,6 +114,22 @@ struct VM_t {
115typedef struct VM_t VM;
115typedef struct VM_t VM;
118+/* C data interface: allocation on the C heap.
120+ * Although not enforced in code, CData is meant to be opaque
121+ * and non-RTS code (such as libraries or C bindings) should
122+ * access it only in the following three ways:
124+ * CData cd = cdata_allocate(...);
126+ * cdata_free(cd); // optionally
129+typedef CHeapItem * CData;
130+CData cdata_allocate(size_t size, CDataFinalizer_t * finalizer);
131+void cdata_free(CData cd); // explicit freeing not required but available
117// Create a new VM
133// Create a new VM
118VM* init_vm(int stack_size, size_t heap_size,
134VM* init_vm(int stack_size, size_t heap_size,
119 int max_threads);
135 int max_threads);