diff options
author | BCG <[email protected]> | 2020-03-30 08:22:42 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-30 14:22:42 +0200 |
commit | 57320c09222560dd3656d3c4bb05a16c1849e9a5 (patch) | |
tree | d8dcb2ef051f4f14dfb0e5380db1f097d6a2df82 | |
parent | 03fa9dd9b7f8fa150641818bff0cdec3d29df71d (diff) | |
download | tinygo-57320c09222560dd3656d3c4bb05a16c1849e9a5.tar.gz tinygo-57320c09222560dd3656d3c4bb05a16c1849e9a5.zip |
runtime: export implementations of malloc/free for use from C
-rw-r--r-- | src/runtime/baremetal.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/baremetal.go b/src/runtime/baremetal.go index 892aff923..825672019 100644 --- a/src/runtime/baremetal.go +++ b/src/runtime/baremetal.go @@ -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) +} |