CLOPEN(3)             Standard Compute Layer (CL) Manual             CLOPEN(3)



NAME
       clopen,  clsym,  clclose,  clerror,  claddr  - programming interface to
       dynamic CL loader

SYNOPSIS
       #include <stdcl.h>

       void* clopen( CONTEXT* cp, const char* filename, int flags);

       cl_kernel clsym( CONTEXT* cp, unsigned int devnum, void* handle,  const
       char* symbol, int flags);

       int claddr( CONTEXT* cp, void* addr, CL_info* info);

       char* clerror( void );

       int clclose( CONTEXT* cp, void* handle);

       Link with -lstdcl.

DESCRIPTION
       The  functions clopen(), clsym(), clclose(), and clerror() implement an
       interface for dynamically loading compute layer (CL) kernels.

       The function clopen() loads the CL source or binary program file  named
       by  the  NULL-terminated  string  filename and returns an opaque handle
       that may be used as a reference in subsequent calls.  If filename is  a
       NULL pointer then a handle for the main program executable is returned.

       The funcion clsym() takes a handle to a CL source or binary program and
       a  NULL-terminated symbol name and returns the associated CL kernel.  A
       CL context pointer and device number must be specififed to identify the
       appropriate  CL  kernel  to return.  If handle is NULL then all CL pro-
       grams loaded into the specified CL context are searched.

       The function clclose() decrements the reference count on the associated
       handle.   If  the  reference count drops to zero then the CL program is
       unloaded.  The function clclose() returns the reference count  on  suc-
       cess and -1 on error.

       The  function  clerror() returns a human readable string describing the
       most recent error that has occured as a result of a call to any of  the
       functions  clopen(),  clsym(),  clclose()  since the last call to cler-
       ror().  If no error has occured NULL is returned.

       The function claddr() takes as an argument a CL  kernel  and  tries  to
       resolve the name and file where it is located.  Information is returned
       in the cl_kernel_info structure:

           struct cl_kernel_info {
                const char* cli_fname;
                CONTEXT* cli_cp;
                unsigned int cli_devnum;
                const char* cli_kname;
           };

       If no matching kernel is found the fields are set  to  NULL.   claddr()
       returns zero on error and non-zero on success.

EXAMPLE
AUTHOR
       Written by David Richie.

REPORTING BUGS
       Report bugs to <support@browndeertechnology.com>

COPYRIGHT
       Copyright  (C) 2009 Brown Deer Technology, LLC.  Licensed under the GNU
       Lesser General Public License version 3 (LGPLv3).  There is NO WARRANTY
       to the extent permitted by law.

SEE ALSO
       clld(1), clload(3), stdcl(3)





libstdcl-0.7                      2009-11-10                         CLOPEN(3)