Extensions
| From: | Frenaud | Date: | Thu, 23 Nov 2000 17:39:52 +0000 |
| Subject: | Extensions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39021@lists.php.net to get a copy of this message | ||
Hi,
I've got some problems when I make my own extension.
I followed this step:
$PHP_SRC/ext/ext_skel my_module
$PHP_SRC/buildconf
$PHP_SRC/configure
$PHP_SRC/make
then, I've tried this first way after removing support for the appropriate
lines in $PHP_SRC/ext/my_module/config.m4:
$PHP_SRC/configure --enable-my_module
$PHP_SRC/make
$PHP_SRC/make install
Everything was going fine.
I was able to call my own function in php a file.
Afterwards, I've tried a second way ( this is this way which is interessing
me ) after removing support for the appropriate lines in
$PHP_SRC/ext/my_module/config.m4:
$PHP_SRC/configure --with-my_module=shared,$PHP_SRC/my_module/
$PHP_SRC/make
$PHP_SRC/make install
But in my php file, when I call dl("my_module"), I've got this warning
message:
Warning: Unable to load dynamic library 'my_module.so' - ld.so.1:
/usr/local/apache/bin/httpd:
fatal: relocation
error: file my_module.so:
symbol alloc_globals: referenced symbol not found in
/usr/local/apache/htdocs/sessions/essai/essai.php on line 3
I made a ld my_module.so and I obtained following lines:
Undefined first referenced
symbol in file
alloc_globals vmi.so
_zval_copy_ctor vmi.so
_emalloc vmi.so
wrong_param_count vmi.so
zend_get_parameters_ex vmi.so
convert_to_long vmi.so
Here is my source file ( a near source code from your example on Zend.com ):
/*************************************************************/
#include "php.h"
ZEND_FUNCTION(essai);
zend_function_entry vmi_functions[]=
{
ZEND_FE(essai,NULL)
{NULL,NULL,NULL}
};
zend_module_entry vmi_module_entry=
{
"Vmi",
vmi_functions,
NULL,NULL,NULL,NULL,NULL,
STANDARD_MODULE_PROPERTIES
};
#if COMPILE_DL_VMI
DLEXPORT zend_module_entry *get_module(void)
{
return(&vmi_module_entry);
}
#endif
ZEND_FUNCTION(essai)
{
zval **parameter;
if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, ¶meter)
!= SUCCESS))
{
WRONG_PARAM_COUNT;
}
convert_to_long_ex(parameter);
RETURN_LONG((*parameter)->value.lval);
}
/*************************************************************/
Could you help me please?
Thanks