dotnet / ClangSharp

Clang bindings for .NET written in C#
MIT License
951 stars 148 forks source link

Standardization of XML Output #550

Open fredrikhr opened 6 months ago

fredrikhr commented 6 months ago

I struggled to find documentation on the format of the PInvoke generator when XML output mode is chosen.

In my case I am generating bindings for a 3rd party library (i.e. I have no control over the C++ headers I am feeding into the generator) and I see the need to perform some customisations on the generated code. To that end I decided to simply generate the XML output from the ClangSharp generator, parse the XML and generate code myself. The customisations I need are very specific to my project, so I don't feel there is value to contribute with extensions for the C# source generator.

But it would be great if there was a simple way to parse the resulting XML. Either through an XSD or even .NET XML Serialization DTO types. (Of course either one could be generated from the other).

If it doesn't already exist, I'd be happy to contribute both an XSD and/or serialisation types to the ClangSharp project.

fredrikhr commented 6 months ago

I have made a little exploratory attempt at how such XML serialization types might look like in PR #557.