aaronqli
aaronqli

Reputation: 809

Does cl.h work for C++?

I know OpenCL has a C++ binder, but I use a third party library which is currently only working with CL.h. I want to write my program in C++. Is it safe to include cl.h in a C++ program and work with that in C style?

I saw some examples of including cl.h in C++ and they seem to be working. However, I don't know for sure. Is there any specific situation that may cause problems?

Upvotes: 0

Views: 260

Answers (2)

sbabbi
sbabbi

Reputation: 11191

Yes. It is a C/C++ header with proper "extern "C" " guards.

http://www.khronos.org/registry/cl/api/1.0/cl.h

Upvotes: 4

Luchian Grigore
Luchian Grigore

Reputation: 258648

If it's a C header, you can wrap it in extern "C" directives:

extern "C"
{
   #include "CL.h"
}

this tells the linker not to apply name mangling when looking for the functions declared in the header.

Upvotes: 2

Related Questions