Map C struct with union field to Go struct
问题 I'm getting results from syscall to some WinApi in Go. I map simple structs from C code easily, but how to deal with C structs like the following? typedef struct SPC_LINK_ { DWORD dwLinkChoice; # define SPC_URL_LINK_CHOICE 1 # define SPC_MONIKER_LINK_CHOICE 2 # define SPC_FILE_LINK_CHOICE 3 union { LPWSTR pwszUrl; SPC_SERIALIZED_OBJECT Moniker; LPWSTR pwszFile; }; } SPC_LINK, *PSPC_LINK; If all possible types are defined in Go type SPC_LINK struct { dwLinkChoice DWORD Moniker SPC_SERIALIZED