Unions are somewhat hard to implement in Go because they are not a native type. But it is actually possible with some compiler magic. This commit inserts a special "C union" field at the start of a struct to indicate that it is a union. As such a field cannot be written directly in Go, this is a useful to distinguish structs and unions. |
||
|---|---|---|
| .. | ||
| main.c | ||
| main.go | ||
| main.h | ||
| out.txt | ||