dearimgui / dear_bindings

C header (and language binding metadata) generator for Dear ImGui
MIT License
221 stars 12 forks source link

Invalid type declarations emitted for some functions #41

Closed Ldash4 closed 9 months ago

Ldash4 commented 9 months ago

As of a recent change, some type declarations are emitted with a "bounds" of "None".

For instance, ImGui_ComboChar has a parameter type of "const char*const[None]" and a description.bounds of None.

This was found against commit 6addf28c4b5d8 of Dear ImGui.

Edit:

I just found that I had a workaround for what seems to be an older version of this bug. In my code this is interpreted as pointer decay c style arrays in some functions, in case that helps.

ShironekoBen commented 9 months ago

Oh, you're absolutely right... Thanks for the report!

I don't know how I missed that, but the metadata generator wasn't checking the absence of bounds information and just blindly converting whatever it had to a string, resulting in const char*const[None], which the type comprehension system then dutifully parsed as a reference to a constant called None and emitted that as the bounds!

I've fixed it in 488c57e820f92deffd99416221dad689f64b5a08 - that should cause it to correctly emit unbounded arrays with a signature of "[]" and no specified bounds key in the JSON.

Hopefully that fixes things for you - if not then let me know and I'll take a further look.

Ldash4 commented 9 months ago

This did fix it, thanks!