Bug in the clGetPlatformIDs() method of the AMD OpenCL implementation

Discussion created by virtu4lity on May 20, 2016
Latest reply on Jun 2, 2016 by dipak

I'm not sure whether this is the right place to report this but I think that there is a bug in the current AMD implementation of the clGetPlatformIDs() method. After investigating why one of my companies applications suddenly started to have dll load issues on some of our customer machines I found out that the OpenCV library calls the clGetPlatformIDs() method of the OpenCL and the the AMD implementation in this case seems to use the SetDllDirectory() method of the Windows API (SetDllDirectory function (Windows) ) the first time it is called, probably to manage it's own dll dependencies. As stated in the MSDN documentation this effectively affects all subsequent calls to LoadLibrary/LoadLibraryEx by changing the dll search order and not searching the working directory for dlls and dependencies anymore. This means I have to reset that change by calling the SetDllDirectory() method with a NULL parameter after the first call to the clGetPlatformIDs() method, which should instead be done by the implementation of the clGetPlatformIDs() method itself in order to not affect the subsequent functionality of the process.