Added passthroughs and small fix for malloc/free
This commit is contained in:
23
stdlib/mem.krak
Normal file
23
stdlib/mem.krak
Normal 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);
|
||||
"""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user