OpenCL C/C++ dynamic binding library (win32 and more)

久未见 提交于 2019-12-07 13:26:30

问题


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 OpenGL ? I'd like to avoid the hassle to do it myself.

Thanks,


回答1:


Here you go:

http://clcc.sourceforge.net/clew_8h.html




回答2:


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.




回答3:


QtOpenCL http://labs.qt.nokia.com/2010/04/07/using-opencl-with-qt/



来源:https://stackoverflow.com/questions/5030854/opencl-c-c-dynamic-binding-library-win32-and-more

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!