deendee Posted May 22, 2006 Share Posted May 22, 2006 SCENARIO: I've used PHP extensively BUT am very new to extending it. However I've quickly got to get PHP 4.3.xtalking 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 fromwhat 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 externalprogram - 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 loadablemodule? Please advice Quote Link to comment https://forums.phpfreaks.com/topic/10177-building-php-extensions/ Share on other sites More sharing options...
trq Posted May 22, 2006 Share Posted May 22, 2006 Im no expert here, but I assume it just depends on the API provided by the AI application.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. Quote Link to comment https://forums.phpfreaks.com/topic/10177-building-php-extensions/#findComment-37978 Share on other sites More sharing options...
morongo Posted June 17, 2006 Share Posted June 17, 2006 I'd like to know more about this myself.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).[input]->[php4ts.dll]->[output]...............<script> 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. Quote Link to comment https://forums.phpfreaks.com/topic/10177-building-php-extensions/#findComment-46592 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.