runtime: export implementations of malloc/free for use from C

This commit is contained in:
BCG
2020-03-30 08:22:42 -04:00
committed by GitHub
parent 03fa9dd9b7
commit 57320c0922
+10
View File
@@ -28,3 +28,13 @@ var (
globalsEnd = uintptr(unsafe.Pointer(&globalsEndSymbol))
stackTop = uintptr(unsafe.Pointer(&stackTopSymbol))
)
//export malloc
func libc_malloc(size uintptr) unsafe.Pointer {
return alloc(size)
}
//export free
func libc_free(ptr unsafe.Pointer) {
free(ptr)
}