C Specification

Extension function pointers for a given platform can be obtained with the function:

// Provided by CL_VERSION_1_2
void* clGetExtensionFunctionAddressForPlatform(
    cl_platform_id platform,
    const char* func_name);
clGetExtensionFunctionAddressForPlatform is missing before version 1.2.

Or, with the function:

// Provided by CL_VERSION_1_0
void* clGetExtensionFunctionAddress(
    const char* func_name);

Description

The returned function pointer should be cast to a function pointer type matching the extension function’s definition defined in the appropriate extension specification and header file.

A return value of NULL indicates that platform is not a valid platform or that the specified extension function does not exist for the platform.

A non-NULL return value from clGetExtensionFunctionAddressForPlatform does not guarantee that an extension function is actually supported by the platform. The application must also query CL_PLATFORM_EXTENSIONS or CL_DEVICE_EXTENSIONS to determine if an extension is supported by an OpenCL platform or device.

Since there is no way to qualify the clGetExtensionFunctionAddressForPlatform query with a device, the function pointer returned must work for all implementations of and extension on different devices for a platform. The behavior of calling a device extension function on a device not supporting that extension is undefined.

clGetExtensionFunctionAddressForPlatform may not be used to query for core (non-extension) functions in OpenCL. For extension functions queried using clGetExtensionFunctionAddressForPlatform, implementations may also choose to export those functions statically from the object libraries implementing those functions, however, portable applications cannot rely on this behavior.

See Also

Document Notes

For more information, see the OpenCL Specification

This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0