From: Gustavo Niemeyer Date: Tue, 11 Jan 2011 16:12:06 +0000 (-0500) Subject: cgo: export unsafe.Pointer as void* X-Git-Tag: weekly.2011-01-12~30 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9f178edf516ee6420e6e6709ae4e91a0a360f3f7;p=gostls13.git cgo: export unsafe.Pointer as void* This will enable functions which use unsafe.Pointer as an argument to be correctly exported by cgo. R=rsc CC=golang-dev https://golang.org/cl/3849043 --- diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 481fff2197..c3f9ae60b1 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -606,6 +606,11 @@ func (p *Package) cgoType(e ast.Expr) *Type { } return r } + case *ast.SelectorExpr: + id, ok := t.X.(*ast.Ident) + if ok && id.Name == "unsafe" && t.Sel.Name == "Pointer" { + return &Type{Size: p.PtrSize, Align: p.PtrSize, C: "void*"} + } } error(e.Pos(), "unrecognized Go type %T", e) return &Type{Size: 4, Align: 4, C: "int"}