MochiLibraries / Biohazrd

A framework for automatically generating binding wrappers for C/C++ libraries
MIT License
60 stars 9 forks source link

A string lookup should be provided for macros #249

Open PathogenDavid opened 3 weeks ago

PathogenDavid commented 3 weeks ago

Right now macros are organized in an immutable array, but it can be helpful to look them up by name without just evaluating them blindly.

We should consider providing a lazily-created ImmutableDictionary of them in addition to the array.

This came up when manually translating PortAudio's macro-style enums, which do not have identifying prefixes and had to be listed manually. (EG: PaSampleFormat)

On the flip side however, it might be kinda non-obvious why we offer both (iterating an array is valuable for certain libraries, IE: Win32.) Maybe the dictionary should only be internal?

PathogenDavid commented 3 weeks ago

Mochi.DearImGui's ImVersionConstantsTransformation would also benefit from this.