Most applications (and libraries) using OpenGL on Linux load libGL.so at runtime using dlopen API, instead of dynamically linking against it.
Why do they do this?
The only reason I can imagine is that it’s because any graphic driver vendor provides a different libGL, and two different libGL could be ABI incompatible. (Well, hum, why should they be ABI incompatible? And even if they are, why loading them via dlopen would fix this issue?)
Anyway, supposing there’s a good reason for doing that, I’d like to do that as well. Does anybody have a link to an opensource C/C++ code that loads all the OpenGL functions via dlopen, which I can include to my project without needing too many tweaks?
There are two main reasons people do this: