Building PHP Extensions
Posted 22 May 2006 - 12:57 PM
talking to a certain C/C++ application that I am building for AI routines. I've also checked out a lot of "Building Custom PHP Extensions" tutorials, even the manual at [a href=\"http://www.php.net/manual/en/zend.php\" target=\"_blank\"]http://www.php.net/manual/en/zend.php[/a] and liked them much. HOWEVER they deviate from
what am looking for. Actually, what I see described @ [a href=\"http://www.zend.com/php/internals/extension-writing1.php\" target=\"_blank\"]http://www.zend.com/php/internals/extension-writing1.php[/a] appears like she's building certain functionality into PHP (I guess that's only half of how one can extend PHP) rather than get PHP to use functionality from an external
program - much like interfacing it with MySQL or GD etc. I wish she was describing the latter method rather than the former.
QUESTION: How then do I interface PHP with the C/C++ program without duplicating the AI effort into the PHP loadable
module? Please advice
Posted 22 May 2006 - 03:53 PM
If its a working stand allone application, it might be just as easy to use exec() or system() to use its functionality within php.
Your best bet is probably to download the php source and check out one of the smaller extensions. sqlite seems a fairly tidy extension with a nice clear API, I'de go from there.
Posted 17 June 2006 - 07:04 AM
I'd like to use php as a sort of scripting engine in a native c/c++ executable, just to allow users to dynamically change a buffer's contents (nothing to do with web services).
In other words, the php dll would run the selected script, modify the text buffer, and return the modified contents to the main app. End users would write the script to use in processing the text, according to their needs.
Here's what I've found so far:
Raydium game engine uses php for scripting (open src, google it, I don't have the url)
There's also a wrapper called SWIG that might be of use, maybe.
Check both the PEAR and PECL extension repositories if you haven't already.
I'm just getting started, so don't have any definitive results yet.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users