bottlenoselabs / c2cs

Generate C# bindings from a C header.
MIT License
250 stars 18 forks source link

Declare structs as partial #152

Open shayded-exe opened 1 year ago

shayded-exe commented 1 year ago

Declaring structs as partial would allow for easy addition of conversion operators.

lithiumtoast commented 1 year ago

Hey @shayded-exe,

This is a great idea. Partial is already applied to the generated static class, so it makes sense to have it for the generated struct as well.

You can find the code that would need to be changed here: https://github.com/bottlenoselabs/c2cs/blob/main/src/cs/production/C2CS.Tool/Features/WriteCodeCSharp/Domain/CodeGenerator/Handlers/StructCodeGenerator.cs#L37

shayded-exe commented 1 year ago

Cool, I'll make a PR when I get around to it!