mirror of
https://github.com/golang/go
synced 2024-11-25 04:17:57 -07:00
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
This commit is contained in:
parent
632be89407
commit
9f178edf51
@ -606,6 +606,11 @@ func (p *Package) cgoType(e ast.Expr) *Type {
|
|||||||
}
|
}
|
||||||
return r
|
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)
|
error(e.Pos(), "unrecognized Go type %T", e)
|
||||||
return &Type{Size: 4, Align: 4, C: "int"}
|
return &Type{Size: 4, Align: 4, C: "int"}
|
||||||
|
Loading…
Reference in New Issue
Block a user