Fix export & handle unsafe.pointer types

This commit is contained in:
Andrea Maria Piana 2020-06-02 17:30:19 +02:00
parent b8d64cbb1e
commit de698e64a3
2 changed files with 7 additions and 6 deletions

View File

@ -2,15 +2,14 @@ package main
const prelude = `package main
// #include <stdlib.h>
import (
"C"
mobile "github.com/status-im/status-go/mobile"
)
import "C"
import "unsafe"
import mobile "github.com/status-im/status-go/mobile"
func main() {}
`
const intType = "int"
const stringType = "string"
const unsafePointerType = "unsafe.Pointer"
const unsafePointerType = "&{unsafe Pointer}"
const boolType = "bool"

View File

@ -56,6 +56,8 @@ func handleFunction(name string, funcDecl *ast.FuncDecl) string {
output += paramIdentity.Name
typeString := fmt.Sprint(paramIdentity.Obj.Decl.(*ast.Field).Type)
// We match against the stringified type,
// could not find a better way to match this
switch typeString {
case stringType:
output += " *C.char"