Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12749 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6914 invoked by uid 1010); 12 Sep 2004 18:47:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 6805 invoked from network); 12 Sep 2004 18:47:31 -0000 Received: from unknown (HELO www.softwarekombinat.de) (213.133.100.117) by pb1.pair.com with SMTP; 12 Sep 2004 18:47:31 -0000 Received: from softwarekombinat.de (dialin-80-228-134-088.ewe-ip-backbone.de [80.228.134.88]) by www.softwarekombinat.de (Postfix) with ESMTP id 532B110B00; Sun, 12 Sep 2004 20:54:09 +0200 (CEST) Message-ID: <414499BB.4090203@softwarekombinat.de> Date: Sun, 12 Sep 2004 20:47:23 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: de, de-de, en-us, en MIME-Version: 1.0 To: Wez Furlong Cc: internals@lists.php.net References: <20040910205515.54074.qmail@pb1.pair.com> <4e89b426040911025158f6ce0@mail.gmail.com> In-Reply-To: <4e89b426040911025158f6ce0@mail.gmail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] php_module_startup: more than one additional_module impossible? From: nw@softwarekombinat.de (Norbert Wagner) Hi, thank's for your answer! Wez Furlong wrote: > You might be right about that. > The current prototype does allow this though: > > zend_module_entry modules[2] = { > { ... first module ... }, > { ... second module ... } > }; > > php_module_startup(&sapimodule, modules, sizeof(modules)/sizeof(modules[0])); That won't work, I fear, because php_module_startup() passes &modules to php_startup_extensions(), which iterates of it the "normal" way. You need zend_module_entry** - parameter for this to work properly :-( > There are other ways to fire up additional modules dynamically; take a > look at the code in ext/standard/dl.c to see how the dl() function > (and "extesion=" init statement) works. I tried to call php_dl() directly, but this functions doesn't get exported. Then I tried to invoke dl() via call_user_function(), but this also failed - probably because I need a request context to do this (?). My next thought was to copy php_dl() and load the extensions by hand after php_module_startup(), but this didn't succeed, either: I saw my modules via get_loaded_extensions(), but my classes did not get registered correctly (They were simply not declared in "script-space"). Perhaps the sequence in php_module_startup() is essential here, I don't know... A solution might be to add a new php_module_startup_ex(...) function with the right parametes, and let php_module_startup() be a wrapper around it. At least this would keep existing SAPI-modules working: /* {{{ php_module_startup */ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules) { return php_module_startup_ex( sf, &additional_modules, num_additional_modules ); } /* {{{ php_module_startup_ex */ int php_module_startup_ex(sapi_module_struct *sf, zend_module_entry **additional_modules, uint num_additional_modules) { /* old php_module_startup() body here */ } What do you think? Regards, Norbert > --Wez. > > On Fri, 10 Sep 2004 22:55:18 +0200, Norbert Wagner > wrote: > >>Hi, >> >>I need to load more than one "additional_module" in my self-made >>SAPI-module. >> >>Looking around at the php/zend-API, I thought that the >>php_module_startup(...) function provides such functionality: >> >>int php_module_startup(sapi_module_struct *sf, zend_module_entry >>*additional_modules, uint num_additional_modules) >> >>But then, It looks to me that the *additional_modules - parameter is >>lacking an indirection: Shouldn't it be **additional_modules or >>*additional_modules[] instead? >> >>As long as you try to register only one additional module (which is what >>all the other SAPI-Modules do that I have found), everything is fine. >>But I'd like to register an arbitrary number of modules during startup >>without reading php.ini. >> >>Any Ideas? I am quite new to PHP, perhaps I have just missed the spot? >> >>Regards, >>Norbert >> >>-- >>PHP Internals - PHP Runtime Development Mailing List >>To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >