Skip to content
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

Feature/DLL (study) #247

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

Feature/DLL (study) #247

wants to merge 13 commits into from

Conversation

KinoxKlark
Copy link
Member

Starting the DLL feature as discussed in other PRs and issues.

Starting from @pvallet's proposal: #229, thanks!

The idea is to check whether it is doable in the long run to not compile DearImGui directly inside pyimgui but as an independent DLL. This would solve the code duplication problem of submodules such as internal and should offer the possibility to develop addons such as pyimplot or pyimnode without having to bake them inside pyimgui.

Objectives of this branch are to

  • Propose a version of pyimgui that compile DearImGui as an external DLL and uses it.
  • Measure its performance against the statically linked version
  • Propose a branch from which prototypes of addons may be developed in order to understand what would be the best setup for external developers to extend pyimgui functionalities.

Big thanks to @Inventor-Mentor for his insight and thoughts on that matter. See his post for more information: #244 (comment)

@pvallet
Copy link

pvallet commented Nov 15, 2021

Thank you for looking into this. In terms of ideas on how to go about this moving forward, I would suggest following the pattern that is used by pySDL2. The python wrapper around the DLL is a python pure project, which makes maintaining it and deploying it very simple (you don't need to build wheels or anything).
Instead, all the DLLs are built separately in another python package, and can be worked on independently.

@learn-more
Copy link
Collaborator

btw, it is not recommended to use Dear ImGui as dll:

// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
// DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.

@KinoxKlark
Copy link
Member Author

Yes I know; the problem is that it seems to be the cleanest way to share the implementation between different python modules (core, internals, etc), avoiding duplicates, as it is the case now. Moreover, it would allow to easily communicate between python and other languages, such as C++, in which core functionalities of an user app may be implemented.

I may have overlooked some options; any suggestion is welcome.

@KinoxKlark KinoxKlark changed the base branch from dev/version-2.0 to master April 20, 2023 07:26
@davisrivian
Copy link

Any progress on this? I'm trying to accomplish a similar task.

@Inventor-Mentor
Copy link

Many thanks for all the hard work you have done to this end updating PyImGui. Regarding Feature/DLL there are imho two potentially relevant or at least interesting repositories:

https://github.com/harskish/pyplotgui) from @harskish updating to previous work from @hinxx to PyImGui 2.0 dev version

Maybe harskish could update his extensions to PyImGUI 2.0 final and create a pull request for taking the study of the DLL feature further.

For comparison (potential performance benchmarks), there is also an alternative Python integration from harskish in this repository:

https://github.com/harskish/imviz

Of cause, there are other interesting extensions like imnode and imgui-knobs, for example.
Hope that helps and best wishes!

Peter

@KinoxKlark
Copy link
Member Author

Hey, thanks for reaching out. No, I did not manage to progress on this unfortunately. And I probably won't have time to work on it this summer.

I agree with what @Inventor-Mentor is saying, it may be a good place to continue working on the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants