implementing new PHP functions in C
| From: | Phil Howard | Date: | Tue, 18 Jan 2000 02:59:41 +0000 |
| Subject: | implementing new PHP functions in C | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-9211@lists.php.net to get a copy of this message | ||
I understand that enough things have changed in PHP4 over PHP3 that the
document for PHP3 that describes what to do add functions to PHP using
C may not be useful, or at least not authoritative. Has anyone started
working on such a document for PHP4 yet? Or has anyone put together a
function package that adds on to PHP4 (isn't part of the PHP distribution)
in C (not C++) that does things the "right" and intended ways which could
be used as an example?
I have numerous library functions I have written in C, and I would like
to implement them in PHP in some way (there would be some differences as
many of them work with pointers, or otherwise do things specific to C).
The issues I probably need to find out (hopefully the documentation will
fill me in on what I neglect here) about are:
1. How best to link the functions in.
2. How to access the data constructs in PHP, especially arrays.
3. How to trap exit time cleanups (essential in mod_php to avoid
memory leakage).
One of my big concerns is the way of linking in. I see two big approaches
to this. One is to integrate the functions directly into the single binary
image at compile/link time, so the functions "just work" with not extra
efforts on the part of the programmre. The other is to make them dynamic.
But it appears that PHP doesn't do dynamic exactly the same way C does, in
that, you still have to add something to PHP at compile time to know about
the functions in the first place (this I gather from having had to compile
in add-ons even though they used dynamica libraries, which seemed rather
pointless to me).
I started in PHP at PHP4 beta, and have already put some pages together in
PHP using PHP4 features, so going back to PHP3 just because there is more
documentation available is not an option. PHP4 is the future so I'll stick
with it (besides, it works fine for me, aside from the lack of some of my
custom functions).
--
| Phil Howard - KA9WGN | for headlines that | Just say no to absurd patents |
| phil-nospam@ipal.net | really matter: | Boycott Amazon.Com (AMZN) |
| Dallas - Texas - USA | linuxhomepage.com | Shop http://bn.com/
instead |