Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-26 Thread John Lim
A bulb lights up! Now i understand. I hand-coded the extension source code based on Rasmus' PHP book, and did not use the skeleton. Thx Andrey "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It is for thread safety access of globals. Defined in basic_functions.h :

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-24 Thread Andrey Hristov
John Lim wrote: "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] G usually comes from Globals and I have seen BG in ext/standard so maybe BG means Basic functions Globals. andrey John Lim wrote: Andi, Just a few quick questions. What is the BG macro for? Eg. if (zend_c

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-24 Thread Andrey Hristov
John Lim wrote: "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] G usually comes from Globals and I have seen BG in ext/standard so maybe BG means Basic functions Globals. andrey John Lim wrote: Andi, Just a few quick questions. What is the BG macro for? Eg. if (zend_c

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-24 Thread John Lim
"Andrey Hristov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > G usually comes from Globals and I have seen BG in ext/standard > so maybe BG means Basic functions Globals. > > andrey > > John Lim wrote: > > Andi, > > > > Just a few quick questions. What is the BG macro for? Eg. > >

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-24 Thread Andrey Hristov
G usually comes from Globals and I have seen BG in ext/standard so maybe BG means Basic functions Globals. andrey John Lim wrote: Andi, Just a few quick questions. What is the BG macro for? Eg. if (zend_call_function(&fci, &BG(fci_cache) TSRMLS_CC) == SUCCESS) Secondly, I think i need to initial

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-24 Thread John Lim
Andi, Just a few quick questions. What is the BG macro for? Eg. if (zend_call_function(&fci, &BG(fci_cache) TSRMLS_CC) == SUCCESS) Secondly, I think i need to initialize the fci_cache structure first with fci_cache = empty_fcall_info_cache; Can I do so in my PHP_MINIT_FUNCTION? Thx. "Andi

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-24 Thread John Lim
Thanks to everyone. I will have a look. I'm porting the adodb extension to php5, so i thought i might as well ask this question that's been bugging me for some time. "Andi Gutmans" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > php5/Zend/zend_execute_API.c. > It's quite simple. I

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-23 Thread Andi Gutmans
php5/Zend/zend_execute_API.c. It's quite simple. If you can't figure it out yourself, let me know. At 08:08 AM 7/23/2004 +0100, Lester Caine wrote: Andi Gutmans wrote: Check out zend_call_function(). It allows you to cache the function lookup in the fci_cache parameter. Where is the best place to

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-23 Thread Lester Caine
Andrey Hristov wrote: You can find some usage of this function in ext/standard/array.c Where is the best place to find zend_call_function details, nothing in the manual and google gives some spurious results. Ta - but I'll leave this to John :) It's a level below where I can usefully help at the m

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-23 Thread Andrey Hristov
You can find some usage of this function in ext/standard/array.c hth, andrey Quoting Lester Caine <[EMAIL PROTECTED]>: > Andi Gutmans wrote: > > > Check out zend_call_function(). It allows you to cache the function > > lookup in the fci_cache parameter. > > Where is the best place to find zend_c

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-23 Thread Wez Furlong
Use the source, Luke. On Fri, 23 Jul 2004 08:08:00 +0100, Lester Caine <[EMAIL PROTECTED]> wrote: > Andi Gutmans wrote: > > > Check out zend_call_function(). It allows you to cache the function > > lookup in the fci_cache parameter. > > Where is the best place to find zend_call_function details,

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-23 Thread Lester Caine
Andi Gutmans wrote: Check out zend_call_function(). It allows you to cache the function lookup in the fci_cache parameter. Where is the best place to find zend_call_function details, nothing in the manual and google gives some spurious results. -- Lester Caine - L.S.C

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread Andi Gutmans
Check out zend_call_function(). It allows you to cache the function lookup in the fci_cache parameter. Andi At 07:17 PM 7/22/2004 +0800, John Lim wrote: Hi, I am using call_user_function_ex() to call mysql_fetch_array, ocifetchinto, etc. error = call_user_function_ex(EG(function_table), NU

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread Lester Caine
Marc Boeren wrote: Doesn't ext/dbx already do what you're doing? John wrote ADOdb so he is looking to speed it up. Which is funny, as I just wrote a pure-PHP version of ext/dbx for use in environments where the C dbx extension is unavailable :-) Need a few more databases in dbx yet. ;) And John's

RE: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread Marc Boeren
> > Doesn't ext/dbx already do what you're doing? > John wrote ADOdb so he is looking to speed it up. Which is funny, as I just wrote a pure-PHP version of ext/dbx for use in environments where the C dbx extension is unavailable :-) Cheerio, Marc. -- PHP Internals - PHP Runtime Development Mai

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread Lester Caine
Wez Furlong wrote: Doesn't ext/dbx already do what you're doing? To answer your original question, no, there isn't really a way to call it directly without duplicating a lot of ugly code. John wrote ADOdb so he is looking to speed it up. IIRC, PHP 5 adds a cache to reduce the lookup overhead for ca

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread Wez Furlong
Doesn't ext/dbx already do what you're doing? To answer your original question, no, there isn't really a way to call it directly without duplicating a lot of ugly code. IIRC, PHP 5 adds a cache to reduce the lookup overhead for call_user_function; you probably won't be able to get it to go much fa

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread George Schlossnagle
On Jul 22, 2004, at 9:39 AM, John Lim wrote: Hi George, 2 reasons. High learning curve to learn all client API's. All the APIs have worked examples in the PHP sources. :) Secondly because of linking issues with the client. E.g. oracle might not be installed on the server. Of course you create a ne

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread John Lim
Hi George, 2 reasons. High learning curve to learn all client API's. Secondly because of linking issues with the client. E.g. oracle might not be installed on the server. John > > If performance is your concern, why not simply call the various RDBMS > API functions directly? > > George -- PH

Re: [PHP-DEV] Calling PHP functions from an extension

2004-07-22 Thread George Schlossnagle
On Jul 22, 2004, at 7:17 AM, John Lim wrote: Hi, I am using call_user_function_ex() to call mysql_fetch_array, ocifetchinto, etc. error = call_user_function_ex(EG(function_table), NULL, &function_name_zval, &retval, 2, ¶ms[1], 0, NULL TSRMLS_CC); This is not giving me the perf