diff --git b/simplicity-sys/depend/simplicity/simplicity_alloc.h a/simplicity-sys/depend/simplicity/simplicity_alloc.h index 492e688..7761d5b 100644 --- b/simplicity-sys/depend/simplicity/simplicity_alloc.h +++ a/simplicity-sys/depend/simplicity/simplicity_alloc.h @@ -1,15 +1,22 @@ #ifndef SIMPLICITY_SIMPLICITY_ALLOC_H #define SIMPLICITY_SIMPLICITY_ALLOC_H #include -/* Allocate with malloc by default. */ -#define simplicity_malloc malloc +/* Declare Rust functions so the compiler can handle them. + * The linker will include the functions from Rust. + */ +extern void* rust_malloc(size_t size); +extern void* rust_calloc(size_t num, size_t size); +extern void rust_free(void* ptr); -/* Allocate+zero initialize with calloc by default. */ -#define simplicity_calloc calloc +/* Allocate with rust_malloc. */ +#define simplicity_malloc rust_malloc -/* Deallocate with free by default. */ -#define simplicity_free free +/* Allocate+zero initialize with rust_calloc. */ +#define simplicity_calloc rust_calloc + +/* Deallocate with rust_free. */ +#define simplicity_free rust_free #endif /* SIMPLICITY_SIMPLICITY_ALLOC_H */