feat: add function to free memory (#2344)

This commit is contained in:
RichΛrd 2021-08-31 15:17:44 -04:00 committed by GitHub
parent 3463853f5f
commit 192ca6e319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,12 @@ func main() {
}
}
// To free memory allocated to strings
output += "//export Free\n"
output += "func Free (param unsafe.Pointer){\n"
output += "C.free(param);\n"
output += "}\n"
fmt.Println(output)
}
@ -135,5 +141,6 @@ func handleFile(parsedAST *ast.File) string {
}
output += handleFunction(name, obj.Decl.(*ast.FuncDecl))
}
return output
}