Added passthroughs and small fix for malloc/free

This commit is contained in:
Nathan Braswell
2014-05-03 20:46:10 -04:00
parent 6a75832b59
commit 9a4507a0f5
3 changed files with 28 additions and 1 deletions

23
stdlib/mem.krak Normal file
View File

@@ -0,0 +1,23 @@
__if_comp__ __C__ __simple_passthrough__ """
#include <stdlib.h>
"""
char* nullPtr = 0;
char* malloc(int size) {
char* memPtr = nullPtr;
__if_comp__ __C__ {
__simple_passthrough__ """
memPtr = malloc(size);
"""
}
return memPtr;
}
void free(char* memPtr) {
__if_comp__ __C__ {
__simple_passthrough__ """
free(memPtr);
"""
}
}