Click to See Complete Forum and Search --> : Creating DLL files for PHP4


Anon
11-15-2000, 07:08 PM
I want to take some C code and create a dll file that will be interpreted by php 4.0.x as a php library (i.e. php_myphplib.dll). What I need to know are the steps taken to make the library recognized by php in both the dll definition and implementation.

I have downloaded and tried to use libmcrypt.dll which is supposed to implement the mcrypt functions. I have tried dl("libmcrypt.dll"); and extension=php_mcrypt.dll and I get the following:
Warning: Invalid library (maybe not a PHP library) 'libmcrypt.dll'
So, I know there is something specific to the dll file that allows it to be interpreted by php.

Any information such as a tutorial, tips, examples, or anything would be great.

Thanks,
Jay Paulson

Anon
11-16-2000, 08:01 PM
You could try com dll's (objects).

Anon
11-20-2000, 09:02 AM
There are pretty explicit instructions on the Zend website. I haven't tried it, but creating a PHP4 extension doesn't look 'too' difficult.

--Ernest

Anon
11-20-2000, 10:12 AM
I'm not sure this will answer your question but I'll hand it to you anyway:

http://www.alt-php-faq.org/#13

From alt.php's FAQ

Anon
05-03-2002, 05:48 PM
It may not "look" difficult but I have yet to find a resolution for dynamically linking libraries with php. When I follow the step by step instructions for their example. http://www.php.net/manual/en/zend.creating.php I still get the error "Invalid library (maybe not a PHP library)" So if anyone has something useful to add - Please do!

fschaper
07-16-2002, 08:40 PM
In order to compile your DLL under windows don't forget that you have to set the preprocessor flag in your sources! In your C file you will find:

#ifdef COMPILE_DL_YOURMODULE
ZEND_GET_MODULE(yourmodule)
#endif

if you haven't set the /DCOMPILE_DL_YOURMODULE Option you will get a DLL without PHP entrypoint and it will simply not work.

The rest of the informations how to create a module you will find at http://www.zend.com/apidoc/ ..

Hope that helps,
Florian