ICD Unloading

In my Win32 single threaded application I support OpenGL rendering by dynamically loading a library explicitly linked to opengl32.lib a,d glu32.lib. I load and unload this utility library using LoadLibrary and FreeLibrary.

I’ve noticed that after the call to LoadLibary both opengl32.lib and glu32.lib are loaded, and on accessing opengl the ICD for the graphics card is also loaded. I can see this using the “Modules” view provided by Visual Studio 6.

However, when I call FreeLibrary (which returns no error or sets no error state), both opengl32.lib and glu32.lib are unloaded but the ICD remains. I have made sure that all rendering contexts are deleted before my call FreeLibrary.

When the app next comes to load my library I believe that the existence of the ICD is causing recource problems. Does anyone know if the ICD is unloaded only on the termination of the process, or if there is any way of forcing it to unload? I have found this behaviour with a number of different ICDs. Has anyone else noticed this behavour?

Many Thanks
Rob

This is not really related to the method you use to do OpenGL stuff (DLL or EXE).
The dynamic library you implemented probably has set a pixelformat to a window. (Watch out, this is not possible to do more than once for the lifetime of a window.)
As long as this window exists the display driver has to make sure that OpenGL can be done on that window and this includes invoking the ICD.
This is not releated to the OpenGL rendering contexts.
Try destroying the complete window, that should remove the ICD.