@@ -62,7 +62,7 @@ func (f *Function) GoArgs(currentModule *modules.Module) string {
6262 if _ , ok := reservedWords [p .Name ]; ok {
6363 p .Name = p .Name + "_"
6464 }
65- typ := p .Type .GoName (currentModule , false )
65+ typ := p .Type .GoName (currentModule , true )
6666 if v , ok := typeMap [typ ]; ok {
6767 typ = v
6868 }
@@ -171,7 +171,7 @@ func (f *Function) WriteGoCallCode(currentModule *modules.Module, cw *CodeWriter
171171 case * typing.PrimitiveType :
172172 sb .WriteString (cw .IndentStr + fmt .Sprintf (" C.%s(%s)" , tt .CName (), p .GoName ()))
173173 case * typing.PointerType :
174- sb .WriteString (cw .IndentStr + fmt .Sprintf (" (*C.%s)(unsafe.Pointer(%s))" , tt .Type .CName (), p .GoName ()))
174+ sb .WriteString (cw .IndentStr + fmt .Sprintf (" (*C.%s)(unsafe.Pointer(%s))" , tt .Type .ObjcName (), p .GoName ()))
175175 default :
176176 sb .WriteString (cw .IndentStr + p .GoName ())
177177 }
@@ -184,8 +184,9 @@ func (f *Function) WriteGoCallCode(currentModule *modules.Module, cw *CodeWriter
184184 } else {
185185 var resultName = "rv"
186186 cw .WriteLine (resultName + " := " + callCode )
187+ cw .WriteLineF ("// %T" , f .ReturnType )
187188 switch tt := f .ReturnType .(type ) {
188- case * typing.StructType :
189+ case * typing.StructType , * typing. PointerType :
189190 cw .WriteLineF ("return *(*%s)(unsafe.Pointer(&%s))" , tt .GoName (currentModule , true ), resultName )
190191 default :
191192 cw .WriteLineF ("return %s(%s)" , returnTypeStr , resultName )
0 commit comments