Build a Wasm test platform in test_gen

This commit is contained in:
Brian Carroll 2021-12-10 17:29:45 +00:00
parent 686d646b09
commit 53d221481e
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,26 @@
#include <stdio.h>
void *roc_alloc(size_t size, unsigned int alignment) { return malloc(size); }
void *roc_realloc(void *ptr, size_t new_size, size_t old_size,
unsigned int alignment)
{
return realloc(ptr, new_size);
}
void roc_dealloc(void *ptr, unsigned int alignment) { free(ptr); }
void roc_panic(void *ptr, unsigned int alignment)
{
char *msg = (char *)ptr;
fprintf(stderr,
"Application crashed with message\n\n %s\n\nShutting down\n", msg);
exit(0);
}
void *roc_memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
void *roc_memset(void *str, int c, size_t n) { return memset(str, c, n); }