I want to dynamically load opengl32.dll using LoadLibrary and
then load its functions with GetProcAddress, but I have a couple
questions.
Will dynamically loading work the same for different OS,
such as Win 95/98/NT/ME/2k/XP?
Can we load a *.so lib dynamically under Linux ? -i don’t want to load opengl libs, i don’t think it’s a good way.
And how to unload them ?
i think that’s may be interressant to load some objects.
Right, dlopen() will do the job. But as you stated, this is a bad idea to load any standard library via dlopen(), just trust the runtime linker ! It prevents you from maintaining tedious function pointers, let the user play with runtime linking via standard mecanism (man ld.so).
If you think that the only reason why you woul do this is when an application wants to use GL only when it’s available, it is also a bad idea : simply compile the GL dependent part as a DLL (.so) linked against GL, then dlopen() it. The runtime linker will do the job for you, and you’ll only have to dlsym() your own symbols.