Linking Kernel with Static Library

Hello all,

I would like to link my OpenCL program with a static library (.a), such that my kernel can call the functions defined within. Currently, I am running the kernel on the CPU (not GPU); this is sufficient for my purposes. The options of clBuildProgram allow me to specify search paths for header files, but I am not certain how to instruct the compiler to link against the desired static libraries. This should be rather straightforward to do, but as a newbie to OpenCL, I require a bit of guidance in this regard.

Thank you kindly for your help!

If I understand your question right, this .a file is standard old CPU code, that you would like to call from inside a kernel? I doubt there is any portable way to do that, precisely because the kernel might not be running on the CPU. I can’t see any fundamental reason it couldn’t be supported on a CPU device, but you’d need to check the docs for the specific OpenCL implementation you’re using.