c-template/sdk/allocator.h

28 lines
732 B
C
Raw Normal View History

2019-04-12 22:02:49 +03:00
#ifndef FLUENCE_C_SDK_ALLOCATOR_H
#define FLUENCE_C_SDK_ALLOCATOR_H
#include <stddef.h> // for size_t
2019-04-21 22:23:36 +03:00
/**
* Allocates a memory region of given size.
*
* Used by Wasm VM for byte array passing. Should be exported from module.
*
* @param size a size of needed memory region.
* @return a pointer to allocated memory region.
*/
2019-04-12 22:02:49 +03:00
void *allocate(size_t size);
2019-04-21 22:23:36 +03:00
/**
* Frees a memory region.
*
* Used by Wasm VM for freeing previous memory allocated by `allocate` function.
* Should be exported from module.
*
* @param ptr the pointer to the previously allocated memory region.
* @param size the size of the previously allocated memory region.
*/
2019-04-12 22:02:49 +03:00
void deallocate(void *ptr, size_t size);
#endif //FLUENCE_C_SDK_ALLOCATOR_H