Description
Function pointer typedefs should be declared for all extensions that add API
entrypoints.
These typedefs are a required part of the extension interface, and should be
provided in an appropriate header, such as cl_ext.h.
The following convention should be followed for all extensions affecting the host API:
#define cl_extension_name 1
#define CL_EXTENSION_NAME_NAME "cl_extension_name"
#define CL_EXTENSION_NAME_VERSION CL_MAKE_VERSION(major, minor, patch)
// all data typedefs and token #defines for this extension
#define CL_EXTENSION_ENUM_NAME_TAG 0xXXXX
// function types for extension functions
typedef return_type
clExtensionFunctionNameTAG_t(...);
// function pointer typedefs for extension functions
typedef clExtensionFunctionNameTAG_t *
clExtensionFunctionNameTAG_fn;
// extension function prototypes (optional)
extern return_type
clExtensionFunctionTAG(...);
where TAG can be KHR, EXT or vendor-specific.
Consider, for example, the cl_khr_ extension.
This extension adds the following to cl_ext.h:
#define cl_khr_create_command_queue 1
#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_NAME \
"cl_khr_create_command_queue"
#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
typedef cl_properties cl_queue_properties_khr;
typedef cl_command_queue CL_API_CALL
clCreateCommandQueueWithPropertiesKHR_t(
cl_context context,
cl_device_id device,
const cl_queue_properties_khr* properties,
cl_int* errcode_ret);
typedef clCreateCommandQueueWithPropertiesKHR_t *
clCreateCommandQueueWithPropertiesKHR_fn CL_API_SUFFIX__VERSION_1_2;
#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
extern CL_API_ENTRY cl_command_queue CL_API_CALL
clCreateCommandQueueWithPropertiesKHR(
cl_context context,
cl_device_id device,
const cl_queue_properties_khr* properties,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
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.