RE: [PHP-DEV] extension depending on extension?

From: Date: Wed, 23 May 2001 20:13:33 +0000
Subject: RE: [PHP-DEV] extension depending on extension?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-56534@lists.php.net to get a copy of this message
> Alright, so what I'm doing is wrapping two libraries from the > Jabber Project (http://www.jabber.org). The first is an > xmlnodes wrapper, similar to DOM but more internalized as > well as some other helper functions, the second is jabber > specific functionality. Here is where it gets tricky, the > xmlnode library is dependent on the jabber library. The > xmlnode library is also very useful by itself so I would like > it to be that way. So I have it working great but now that > I'm ready to make the jabber extension use it I'm lost. Can > I make the require each other? Can I register xmlnode > resources from the jabber extension? If I can't do this any > suggestions on the best solution? > > --temas There are several trains of thought on this and Im sure Sterling will make sure you are aware of the other :) You will need to get the dtor handle from the xmlnode extension (The le_* varaibles) to register/work with resources (other than that you can do what you want). Now you could add phpi_get_le_*() calls to the xmlnode extension but this causes problems when one is configured as a shared library and the other as statically build into PHP. Your best bet is probably to use the new Zend API call ZEND_GET_RESOURCE_TYPE_ID(<resource_name>) (Please note this will not be in any PHP distribution until 4.0.7). This will return the resource type id of the resource type with the name <resource_name> which you can then use it as the second value to the ZEND_REGISTER_RESOURCE macro (and any other calls that require this value :)). See pdf.c and cpdf.c for example usage (grep for le_gd) and zend_list.h for the implementation of the macro. The return value should be "cached" locally as this call requires iterating though a hash table which isnt that fast :) HTH, - James

« previous php.dev (#56534) next »