News for hackers. Stuff that matters.
Re:On Go, Portability, and System Interfaces by laxk on Tuesday September 22, 2015 @10:40PM (#10263050)
The method proposed by the author does not work for packed structs. The btrfs library has a lot of them.

main.go

  package main
  /*
  struct packed {
    unsigned char a;
    unsigned long long b;
    unsigned char c;
  } __attribute__((packed));
  */
  import "C"
  type Packed C.struct_packed
go tool cgo -godefs main.go

  package main
  type Packed struct {
	A		uint8
	Pad_cgo_0	[8]byte
	C		uint8
  }
We lost packed.b field. Go doesn't support packed structs. More info here: https://groups.google.com/forum/#!topic/golang-nuts/UX5srUMt...

There are no comments on this comment yet.