On 09/17/17 06:10, Siarhei Siamashka wrote:
Can Yuri tell us more about his dynamic load/reload use case? So far
I'm not aware of anyone doing this in practice.

I instantiate LV2 (audio) plugin UIs, which are mostly gtk in the non-gtk app. I dynamically load libgtkmm/libglib libraries in order to show the UI, then I unload them. This is done with dlopen/dlsym/dlclose.


Maybe the right solution is to add explicit pixman_init() and
pixman_destroy() functions. But we need to support existing
applications too and we can't expect them to start using these
new functions without enforcing some changes. That's a kind of
historical baggage, and nobody feels like opening this can of
worms.


You can't rely on the apps to always call the right functions. Instead, the correct behavior is to uninitialize on exit. What you need to do is to schedule uninitialization with atexit call. (https://linux.die.net/man/3/atexit)

The behavior should be the same as when there is a static C++ object with destructor. Such destructor will always be called via atexit, either at the end of the application, or when the shared library is unloaded.


Yuri

_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to