# Library names per desktop enviroment

**URL:** <https://discourse.glfw.org/t/library-names-per-desktop-enviroment/2145>\
**Category:** dev\
**Created:** [September 4, 2022, 10:29am UTC](https://discourse.glfw.org/t/library-names-per-desktop-enviroment/2145 "2022-09-04T10:29:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxuiji](https://avatars.discourse-cdn.com/v4/letter/z/a4c791/32.png) [@zxuiji](https://discourse.glfw.org/u/zxuiji)\
**Post date:** [September 4, 2022, 10:29am UTC](https://discourse.glfw.org/t/library-names-per-desktop-enviroment/2145/1 "2022-09-04T10:29:30Z")

</div>

I’d like glfw to switch from fixed libglfw.so on linux to libglfw-x11.so etc and make libglfw.so just a wrapper library that searches for them, hooks them, then calls whatever internal initialiser it deems suitable such as `libGlfwSubInit()`, by doing so can resolve the common issue of “wrong library” by just trying each of those in turn until one succeeds or you run out of libraries to search for and try, take this example of output from my own wrapper I’m developing:

```auto
...
Attempting to bind library 'libpawwfx-glfw.so'...
Searching for 'libglfw-x11.so'...
Not found, attempting to open instead...
Searching for 'libglfw-wayland.so'...
Not found, attempting to open instead...
Searching for 'libglfw.so'...
Not found, attempting to open instead...
Hook acquired, attempting to initialise...
Success!
Generating library path with libpawvfx-glew.so...
Attempting to bind library 'libpawvfx-glew.so'...
Searching for 'libGLEW.so'...
Not found, attempting to open instead...
Hook acquired, attempting to initialise...
Success!
Launching Graphics Tests...
...

```

If making glfw a wrapper to them is not possible then make it a symlink to libglfw-x11.so etc, that way the distros can allow multiple desktop environments more easily while also maintaining backwards compatibility for old software that doesn’t support searching for the right library for the DE they’re in.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [September 5, 2022, 11:07am UTC](https://discourse.glfw.org/t/library-names-per-desktop-enviroment/2145/2 "2022-09-05T11:07:05Z")

</div>

My understanding is that GLFW has moved to runtime selection of the platform via the `GLFW_PLATFORM` init hint :

> <https://github.com/glfw/glfw/pull/1958>
>
> This is an initial but mostly functional implementation of compiling GLFW for mu…ltiple platforms. It should be far enough along to both test further and gather feedback on its design, implementation and documentation.
> 
> By default the platform is detected and selected automatically by \`glfwInit\` but it can also be selected explicitly via the \`GLFW\_PLATFORM\` initialization hint. Most platform functions (but not all) are now called from shared code via the function pointer struct \`\_GLFWplatform\` provided by the selected platform.
> 
> The timer, thread and module loading platform functions are still called directly by name and the implementation chosen at link-time. These functions are the same for any backend on a given OS, including the Null backend. The Null backend is now always included but needs to be explicitly selected via init hint.
> 
> The other backends are now enabled via CMake dependent options following the \`GLFW\_BUILD\_\<platform\>\` pattern instead of a mix of automagic and ad-hoc option names.
> 
> Note that there is still work to do, including at least:
> \- \[\] ~The detection logic for X11 and Wayland is still placeholder.~
> \- \[x\] There is no guide documentation.
> \- \[x\] The new functions have not been reviewed for thread safety.
> \- \[x\] The changelog entries are incomplete.
> \- \[\] ~By default non-macOS Unix builds will currently not include Wayland support.~
> \- \[\] ~The joystick implementation selection on non-macOS Unices is kludgy.~

So there won’t be separate libraries for X11 and Wayland anymore once this has been released.

---

<div class="post-metadata">

**Author:** ![zxuiji](https://avatars.discourse-cdn.com/v4/letter/z/a4c791/32.png) [@zxuiji](https://discourse.glfw.org/u/zxuiji)\
**Post date:** [September 25, 2022, 1:00pm UTC](https://discourse.glfw.org/t/library-names-per-desktop-enviroment/2145/3 "2022-09-25T13:00:00Z")

</div>

Forgot about this post, thanks for letting me know, I’ll target that in future when it’s released, I’ll let devs of the desktop environments just compile their own version instead, they can just install/uninstall libpawwfx-glfw-x11.so etc with paw --install-lib \<source\_path\> & paw --remove-lib for libpawwfx.so to search for prior to the generic one, that should resolve the issue
