Page 1 of 1

C++ API wrapper

Posted: Wed Jul 21, 2010 4:39 pm
by jklovanc
I have a third party C++ API that I need to use inside PHP. I do not have the source so I can not compile it for php. How can I get access to the library from PHP?

Thanks in advance,
Joe

Re: C++ API wrapper

Posted: Wed Jul 21, 2010 4:42 pm
by Weirdan
If you can link it to a C program you can use it in PHP by writing an extension for it. All you need is header files for your compiled library (I assume you meant dynamic/static library by 'C++ Api'), you don't need the library's code.

Re: C++ API wrapper

Posted: Wed Jul 21, 2010 5:08 pm
by jklovanc
I have the .hpp files and it is a dynamic library. Is there a way of creating the extension without having to write additional c++ code and compiling it?

Thanks,
Joe

Re: C++ API wrapper

Posted: Thu Jul 22, 2010 2:18 am
by Weirdan
jklovanc wrote:Is there a way of creating the extension without having to write additional c++ code and compiling it?
No, extensions are libraries on itself and thus need to be compiled.