I want to develop an audio plugin that will be loaded as a shared library at runtime by the host/application. My question is if GLFW instance is thread safe, and if it does not use global variables, so there will be many instances when plugins based on GLFW will be loaded into the application address space. For example, with Qt this is impossible since you need to have only one QtApplication instance per process because it uses global bindings. Also there is a problem due to this if two different plugins use different versions of Qt toolkit. Can I overcome these problems with GLFW?
The GLFW documentation describes the thread safety of GLFW functions. The short answer is that many functions must be called from the main application thread for Operating System dependent reasons.
GLFW does contain global state. However this doesn’t prevent you from using it in a application which loads plugins as you can compile GLFW as a shared library. You would then need to write some application code to handle some of the shared functionality such as event polling. Plugins will need to be compiled against the same version of GLFW.
An alternative is that you can expose the functionality you need via your own application API.