Hi,

I'm developing a Go wrapper for a dll.
dll contains the following structure:
struct ck_version {
  unsigned char major;
  unsigned char minor;
};

struct ck_info {
  struct ck_version cryptoki_version;
  unsigned char manufacturer_id[32];
  ck_flags_t flags;
  unsigned char library_description[32];
  struct ck_version library_version;
};

in Go there is its analogue:
type Ck_version struct {
    Major uint8
    Minor uint8
}

type Ck_info struct {
    Cryptoki_version    Ck_version
    Manufacturer_id     [32]byte
    Flags               uint32
    Library_description [32]byte
    Library_version     Ck_version
}

when i call the function
    info := Ck_info{}
    rv, _, _ := c_GetInfo.Call(uintptr(unsafe.Pointer(&info)))

then I get the data offset starting from the flags field.

I understand that Go has different data alignment in structures than C 
compiler. But how then does a wrapper with tons of structures work in this 
project golang.org/x/sys/windows? Maybe I missed something?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20cc4c3b-b7fb-4c6b-b09d-333069d59d76n%40googlegroups.com.

Reply via email to