-
Notifications
You must be signed in to change notification settings - Fork 102
Thoughts about supporting imgui extensions #153
Comments
Hello there and thank you for your thoughts. Similar to a somewhat related topic brought up in #112 , especially with your conclusions about complexity, my answer back then still holds: Added to that is also the question about "scale" in the farthest sense: Which extensions should be included in this uber-wrapper (regardless of the chosen approach)? What are the criteria? You brought up one extension, I know there's at least one for file dialogs people might find useful, and there's probably plenty more. Instead, I'd think of a wrapper-generator tool. Similar to the approach of In short, any attempt for adding any extensions must be done in a dedicated repo/project - I don't intend to take on this task. |
Not directly, I'm aware that any solution to this problem will be quite disruptive, so it makes more sense to have it in a fork or completely new project. But it would be useful to coordinate so if I start working on a solution it would be an almost drop-in replacement for Creating a generator is probably the best solution, and if it's based on It's also the solution that has the steepest initial development curve - I took a stab at it a few days ago, and while it can be done, it does require a lot of work to get it up and running. I'll take a look at |
A compatible drop-in replacement sounds good! Having a generated approach, capable of adding extensions, with hand-crafted meta information does also feel better than hand-crafting just the base library. Especially if the users are allowed to select what they actually need. I'm curious with what you come up with. As for coordination: Since I'm only focusing on the official base library, this area is predictable. |
I've been looking at some of the larger extensions for imgui (like implot), and thinking about how best to use these together with imgui-go.
Ideally, it would make the most sense to create new packages, i.e.
github.com/inkyblackness/imgui-go
for the base imgui integration, and something likegit.luolix.top/ptxmac/implot-go
for each extension that makes sense to wrap.Unfortunately, this hits a limitation of how cgo works; when adding c/cpp code to a go package, everything will be linked statically. This means that two packages cannot compile the same c/cpp code since this results in duplicate symbols.
In the of
imgui-go
it means only one package can include"imgui.cpp"
(and friends). Butimplot
can't be compiled without, so there's a conflict if two separate go packages both want to includeimgui.cpp
I've been trying a few different things, but so far I've only found a few solutions, and none of them is "pretty":
implot
in the same package asimgui
, but prefix it withImplot_
(or similar). Some tricks with go build tags could be used to be able to ignore allimplot
code if not needed (either opt-in or opt-out).package/implot
have a methodShowDemo
which is just a direct call topackage/internal/clib.ShowDemo
. A lot of complication, but it would make the packages somewhat neater for users.As a side note, I also took a look at things like
cimgui
/cimplot
, but they won't fix any one of the problems here, except the double wrapping in 2. would be much easier to maintain since most could just be generated from the JSON definitionsI'm hoping I've missed a better solution, but it seems cgo is not very flexbile when wanting to use the same C code in several packages
The text was updated successfully, but these errors were encountered: