mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-20 20:39:06 +00:00
runtime: export implementations of malloc/free for use from C
This commit is contained in:
@@ -28,3 +28,13 @@ var (
|
|||||||
globalsEnd = uintptr(unsafe.Pointer(&globalsEndSymbol))
|
globalsEnd = uintptr(unsafe.Pointer(&globalsEndSymbol))
|
||||||
stackTop = uintptr(unsafe.Pointer(&stackTopSymbol))
|
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)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user