C++ API wrapper

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jklovanc
Forum Newbie
Posts: 2
Joined: Wed Jul 21, 2010 4:35 pm

C++ API wrapper

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: C++ API wrapper

Post 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.
jklovanc
Forum Newbie
Posts: 2
Joined: Wed Jul 21, 2010 4:35 pm

Re: C++ API wrapper

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: C++ API wrapper

Post 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.
Post Reply