mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cgo: add GoBytes, fix gmp example
Fixes #1640. Fixes #2007. R=golang-dev, adg CC=golang-dev https://golang.org/cl/4815063
This commit is contained in:
parent
acb02ebc30
commit
db9229def8
8 changed files with 55 additions and 4 deletions
|
|
@ -1140,6 +1140,14 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
|
|||
t.Align = c.ptrSize
|
||||
break
|
||||
}
|
||||
if dt.Name == "_GoBytes_" {
|
||||
// Special C name for Go []byte type.
|
||||
// Knows slice layout used by compilers: pointer, length, cap.
|
||||
t.Go = c.Ident("[]byte")
|
||||
t.Size = c.ptrSize + 4 + 4
|
||||
t.Align = c.ptrSize
|
||||
break
|
||||
}
|
||||
name := c.Ident("_Ctypedef_" + dt.Name)
|
||||
t.Go = name // publish before recursive call
|
||||
sub := c.Type(dt.Type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue