go: cmd/cgo: -godefs doesn't handle embedded struct fields correctly
by Mortdeus@gocos2d.org:
Before filing a bug, please check whether it has been fixed since the latest release. Search the issue tracker and check that you're running the latest version of Go: Run "go version" and compare against http://golang.org/doc/devel/release.html If a newer version of Go exists, install it and retry what you did to reproduce the problem. Thanks. What steps will reproduce the problem? This struct... //<libdrm/drm.h> struct drm_stats { unsigned long count; struct { unsigned long value; enum drm_stat_type type; } data[15]; }; When wrapped with cgo as ` Stats C.struct_drm_stats ` gets converted by godefs to ` type Stats struct { Count uint64 Data [15]_Ctype_struct___0 } ` What is the expected output? type Stats struct { Count uint64 Data [15]struct{ Value uint64 //or uint32 Type uint32 } } Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? archlinux x86-64 Which version are you using? (run 'go version') go version devel +4a712e80e9b1 Tue Apr 09 15:00:21 2013 -0700 linux/amd64 Please provide any additional information below. https://github.com/mortdeus/egles/tree/master/drm
About this issue
- Original URL
- State: open
- Created 11 years ago
- Comments: 15 (8 by maintainers)
I’d love to see this fixed. https://utcc.utoronto.ca/~cks/space/blog/programming/GoCGoCompatibleStructs mentions this issue, and has a not so great workaround.