For what they are worth, here are some notes that I took. I don't think they answer the actual question you asked, but they may be useful.
Extensions to PHP are written in C. (I haven't seen a statement to that effect anywhere in the documentation, but I mave missed something.) Assume that your package is called <mybit>. Need libtool 1.4 or better - get it from www.gnu.org or a mirror You need to write a set of interface functions. Function names must be ALL lower case. Before you do that, prepare a prototype file - can be just the names of the functions, one per line, no semicolons, NO BLANK LINES. The entries can be full C prototypes, but complicated prototypes screw it up (char thing() is OK, but char * thing() is not). run ext_skel --extname=<mybit> –proto=<file containing prototypes> That creates a directory ext/<mybit> containing a Makefile, skeleton C source and a header (.h)file. edit config.m4 to switch on the lines that enable <mybit>. Until you do that, nothing will work. cd .. (root of PHP source) ./buildconf ./configure –with-<mybit> make The first time I did this, the make failed because of problems in the .h file. These were caused by stuff in the proto file that the tools couldn't handle. ./php -f ext/<mybit>/<mybit>.php confirms that the skeleton has been added. Reinstall your PHP module. ("make install" as root) In the ext/<mybit> you now have lots of files including <mybit>.c and php_<mybit>.h. <mybit>.c contains a set of wrapper functions, one for each name that you put into your prototype list. Write a test script to call the functions. At this stage, you should get a warning telling you that the function is not yet implemented. This is printed by the skeleton wrapper function. You now need to edit each function. Take out the line that prints the "not implemented" warning and replace it with the code that you want. BEWARE. If you find half-way through the work that you got the prototype file wrong (say, you want to put an extra function in), you have to start all over again. Change the name of the <mybit> directory, create a new one and manually copy the stuff you have produced into it. To avoid this, I put my code into a separate file, got that working in isolation (so that I knew what the function names were going to be) and then made my interface functions very simple wrappers. I could not make any sense of the stuff about parameter passing in the zend documents. I suspect that it doesn't match the standard released PHP. (Somebody said elsewhere in this thread to use a different distribution. That may help.) I figured out how to pass parameters by looking at working examples, such as the LDAP extension. Simon > > -----Original Message----- > > From: Anas Mughal [mailto:[EMAIL PROTECTED]] > > Sent: 15 January 2002 21:12 > > To: [EMAIL PROTECTED] > > Subject: [PHP] Extending PHP > > > > > > I am looking into building a dynamically loadable > > module under PHP4. The documentation on extending PHP4 > > is unclear or is missing instructions on how to > > generate dynamic loadable module file. I have followed > > the instructions but I can't seem to be able to create > > the module. > > (I even looked at Sterling Hughes article on > > WebTechniques.) > > Is there a step that I am missing or what? > > Do I need to modify the m4 file or the makefile? > > Please advise... > > > > ===== > > Anas Mughal > > [EMAIL PROTECTED] > > [EMAIL PROTECTED] > > Tel: 973-249-6665 > > > > __________________________________________________ > > Do You Yahoo!? > > Send FREE video emails in Yahoo! Mail! > > http://promo.yahoo.com/videomail/ > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]