Added math.h, stdlib.h, float.h, and stbool.h to std folder (and all their implementations). Opted to NOT implement malloc/free/etc. in favor of having our own functions init_mem, grow_mem, and get_mem.
This commit is contained in:
9
cwasm.c
9
cwasm.c
@@ -10,8 +10,13 @@ Description:
|
||||
|
||||
#include "std/src/std_main.c"
|
||||
|
||||
WASM_EXPORT(HelloFromWasm) int HelloFromWasm(int value)
|
||||
WASM_EXPORT(HelloFromWasm) float HelloFromWasm(float value, float value2)
|
||||
{
|
||||
printf("Called HelloFromWasm(%d)!\n", value);
|
||||
printf("Called HelloFromWasm(%g)!\n", fmodf(value, value2));
|
||||
for (int iIndex = 0; iIndex < 1024; iIndex++)
|
||||
{
|
||||
void* newMem = grow_mem(1024);
|
||||
printf("mem[%d] = %p\n", iIndex, newMem);
|
||||
}
|
||||
return value*(value+1)*2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user