Does cilium/ebpf help with keeping constants and types in sync between Go and C #1342
-
Does |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Can you give an example what you mean? |
Beta Was this translation helpful? Give feedback.
-
I'm fairly new to eBPF programming and this is what I face: An eBPF program written in C and a user-space program written in Go. Both exchange data via an eBPF map. Conceptually, the eBPF map contains a union, so there is a field of type integer ( If the two files get out of sync, things obviously go awry. In order to mitigate against one could link C into Go (this has downsides) or envisage e.g. a tool that can generate one representation from the other (e.g. Go from C). So this is the area I had in mind. Is it clearer now? |
Beta Was this translation helpful? Give feedback.
-
@brycekahle Perfect, thank you. |
Beta Was this translation helpful? Give feedback.
You should look into using
go tool cgo -godefs types.go
against a file like this: