bashbaug / opencl-runtime-loader

OpenCL Runtime Loader Library
MIT License
2 stars 0 forks source link

add build option for clGetExtensionFunctionAddress behavior #11

Open bashbaug opened 4 years ago

bashbaug commented 4 years ago

clGetExtensionFunctionAddress has been deprecated but it still can be useful in some cases and some applications rely on it. The OpenCL runtime loader should optionally support it by dynamically loading the real OpenCL ICD loader similar to clGetPlatformIDs even if the default is to return NULL to encourage use of clGetExtensionFunctionAddressForPlatform instead.

This behavior is currently hard coded with an ifdef:

CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddress(
    const char* function_name)
{
#if 0
    static _sclModuleHandle module = _sclOpenICDLoader();
    _sclpfn_clGetExtensionFunctionAddress _clGetExtensionFunctionAddress =
        (_sclpfn_clGetExtensionFunctionAddress)::GetProcAddress(
            module, "clGetExtensionFunctionAddress");
    if (_clGetExtensionFunctionAddress) {
        return _clGetExtensionFunctionAddress(function_name);
    }
#endif
    return NULL;
}