Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:37248 php.internals:37249 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28128 invoked from network); 26 Apr 2008 19:16:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2008 19:16:02 -0000 X-Host-Fingerprint: 98.210.212.242 c-98-210-212-242.hsd1.ca.comcast.net Received: from [98.210.212.242] ([98.210.212.242:28495] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/A2-11391-07F73184 for ; Sat, 26 Apr 2008 15:16:01 -0400 To: internals@lists.php.net,"Edward Z. Yang" Message-ID: <48137F68.3080501@sun.com> Date: Sat, 26 Apr 2008 12:15:52 -0700 User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 CC: internals@lists.php.net References: <19.A1.11391.C0373184@pb1.pair.com> <48137859.1090004@thewritingpot.com> In-Reply-To: <48137859.1090004@thewritingpot.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 98.210.212.242 Subject: Re: Help with calling PHP functions From: dhiru.pandey@sun.com (Dhiru Pandey) Thanks for responding. May be I mis-wrote. What I would really like is a way to call the native c functions of the php implementation directly (bypassing the PHP compiler) like: PHP_FUNCTION(str_repeat) PHP_FUNCTION(addcslashes) etc. In other words I would like to invoke this functions directly thru C or Java. I do not want to callback into a PHP script user function Thanks, -Dhiru Edward Z. Yang wrote: > Dhiru Pandey wrote: >> I am trying to figure out a way to invoke PHP functions directly i.e. >> bypassing the PHP compiler (scanner and parser). For now it would be >> great if I can get some help calling them from C. Ultimately I would >> like to call them from Java. > > It's not difficult to call PHP_FUNCTIONs if you're inside PHP: you > create a zval with the appropriate callback value (a string if you're > dealing with global PHP functions) and then use call_user_function. You > can find detailed instructions here: > http://www.php.net/~wez/extending-php.pdf > > Can't help you for the other, although "Extending and Embedding PHP" by > Sara Golemon, George Schlossnagle and Wez Furlong covers that topic, I > think. >