-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile error when using the features/string_view branch #19
Comments
Ooh, interesting. I haven't tried |
Yeah. ImStr is by value (it's a wrapper around two pointers |
Supporting ImStrv (1.85? 1.86? 1.87?) was one of the leading motivation for rewriting cimgui (well, among with many other leading motivations :) but indeed it hasn't been tested yet. One of the interesting aspect which I am not 100% sure how we can going to handle is that we might need to provide a different cimgui API for raw C users vs for binding users.
Meaning maybe we need two API (two prefixes? two suffixes?)
Possibly we'll just promote building "either" version via a flag to the python script (if we decide we don't support point D). One thing to take into account is how high-level language bindings are likely to be generated. If they are generated using our metadata, it's going to be easy for people to reroute names (e.g. C# |
My guess is that most will use the metadata. I see no reason not to do it that way. |
As for the above question I think it would make sense to have different modes for the generator. In the Rust case I would only want the |
Just FYI I for now manually patched up the static inline ::ImStr ConvertToCPP_ImStr(const cimgui::ImStr& src) {
::ImStr dest = { src.Begin, src.End };
return dest;
} Then did a search/replace with the above so the generated code looks like this CIMGUI_API bool cimgui::ImGui_Begin(cimgui::ImStr name)
{
return ImGui::Begin(ConvertToCPP_ImStr(name));
} Now (after fixing a minor issue in the |
Doing some code-generation test I now (for my Rust wrapper) ends up with this
For a test code that looks like this fn main() {
imgui::begin("test");
} So that is looking pretty good with regards to |
Cool - that rust codegen looks really nice! |
Great! Thanks :) |
Tested this out yesterday and it seems to work fine 👍 |
So a further small update on this - e1ec95a adds auto-generation of helper functions that take Conversion functions aren't inline at the moment - I started looking into that but then realised that having inline functions in the API would torpedo anyone who wanted to use the For the moment the older helper function For the Rust bindings you probably want to check for |
Thanks! I will take a look. |
I'm going to close this for now - please feel free to reopen if you run into further problems. |
Following #11 (comment) And:
Confused about current state of
Probably something like that (and CI can output both variant are artifacts) In theory could have up to three:
First one is merely an optimization tbh and could be skipped for simplicity, although well, in theory it is a nice thing to have! Can be implemented later. Struggling to find the best name for it. |
On the subject of
As for the conversion functions - I think the helpers (as above) probably cover 90%+ of the use-cases here, so the explicit conversion functions ( As such, I'm currently thinking that whilst from a performance perspective inlining/macros would be nice, they probably aren't worth the pain of having separate headers/ifdefs/something until someone has a concrete use-case where inline conversion makes a big difference. It doesn't really affect the API either way (aside from the addition of an extra header/ifdef) so it's a relatively easy change to drop in later. |
When using the
features/string_view
branch of the private dear_imgui GH I'm running into a bunch of issues such as this onewhen I try to use the generated cpp code from the generator.
The text was updated successfully, but these errors were encountered: