OpenCL C/C++ dynamic binding library (win32 and more)
I'm giving a try at OpenCL, and in order to put this in production I'd like to be able to bind dynamically to OpenCL.DLL (when under Windows), in order to handle 'gracefully' the case where no OpenCL is installed on the host computer.
Is there any available library (or code snippet) that takes care of this dynamic binding in C or C++, much like GLEW does for Ope开发者_如何学运维nGL ? I'd like to avoid the hassle to do it myself.
Thanks,
Here you go:
http://clcc.sourceforge.net/clew_8h.html
Since you're dealing with Win32, the easiest solution is delay loading. If you delay-load OpenCL, and the compiler-added stub fails to find it, it will call __pfnDliFailureHook2(dliFailLoadLib)
. You can handle the error there; if you don't provide a handler you'll get the default behavior (program aborts). In either case the program will not have a static dependency on OpenCL.
QtOpenCL http://labs.qt.nokia.com/2010/04/07/using-opencl-with-qt/
精彩评论