as the first thing I have got xml, which has to be serialized and de- serialized. Here I got to know that GO lang will do this serialization and de-serialization i.e. it will create structures from the xml, and we have got that from chidley. As my legacy code is in C and which is dependent on this Structures, this is the reason why I want to convert Go Structs to C Structs.
At present our goal is to use Go lang for Serialization and De- Serialization.
the whole objective here is to parse the xml and generate the C structure. To achieve this, we have found like GO will generate the Structures from the xml. We could able to get the structures generated from Chidley. Now this Structures has to passed to C.
The structures generated by Chidley will use go types. Go types are not the same a C types. Even simpler types like integers have differences. While both have an int type, they are different sizes. On my x86_64 a C int is 4 bytes while a go int is 8. Strings are also different; as are arrays. There is also the small matter that Go is garbage collected and C is not. GC means you have to be really careful about how memory is managed in both systems.
In short, the interoperation between Go and C is not trivial. You won’t be able to just use the structs generated by Chidley.
Since you referred to your C codebase as “legacy”, I assume that you are trying to incrementally move it into Go. I think that putting a data structure that is complicated enough that it needs to be generated on the Go side and all the processing on that data structure on the C side is a terrible idea. I suggest you find a different interaction point to start with. Doing so will give you experience in dealing with the interaction between Go and C so that when you have to deal with this difficult part you will have a better idea on how to do so.