Defines | Functions

clew.h File Reference

OpenCL run-time loader header. More...

Defines

#define CLEW_SUCCESS   0
 Success error code.
#define CLEW_ERROR_OPEN_FAILED   -1
 Error code for failing to open the dynamic library.
#define CLEW_ERROR_ATEXIT_FAILED   -2
 Error code for failing to queue the closing of the dynamic library to atexit()
#define CLEW_ERROR_IMPORT_FAILED   -3
 Error code for failing to import a named function from the dll.

Functions

int clewInit (const char *)
 Load OpenCL dynamic library and set function entry points.
const char * clewErrorString (cl_int error)
 Convert an OpenCL error code to its string equivalent.

Detailed Description

OpenCL run-time loader header.

This file contains a copy of the contents of CL.H and CL_PLATFORM.H from the official OpenCL spec. The purpose of this code is to load the OpenCL dynamic library at run-time and thus allow the executable to function on many platforms regardless of the vendor of the OpenCL driver actually installed. Some of the techniques used here were inspired by work done in the GLEW library (http://glew.sourceforge.net/)


Function Documentation

const char* clewErrorString ( cl_int  error )

Convert an OpenCL error code to its string equivalent.

Parameters:
errorCL error code
Returns:
a string representation of the error code
int clewInit ( const char *  path )

Load OpenCL dynamic library and set function entry points.

Parameters:
pathpath to dynamic library to load
Returns:
CLEW_ERROR_OPEN_FAILED if the library could not be opened CLEW_ERROR_ATEXIT_FAILED if atexit(clewExit) failed CLEW_SUCCESS when the library was succesfully loaded