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?