I had a problem about adding the extension function.
I made my own api for PHP3.0.
I want to link the api with PHP3 module, but I don't know the way.
The source that I program is like that.
This source compiled and linked with php module.
But the function 'temp_printf_func()' is not excuted.
//////////////// c source ///////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include "php.h"
#include "internal_functions.h"
#include "temp.h"
function_entry temp_printf_functions[] = {
{ "temp_printf", php3_temp_printf_func, NULL},
{NULL, NULL, NULL}
};
php3_module_entry temp_printf_module_entry = {
"temp_printf",
temp_printf_functions,
NULL, NULL,
NULL, NULL,
php3_info_temp_printf ,
STANDARD_MODULE_PROPERTIES
"temp_printf",
temp_printf_functions,
NULL, NULL,
NULL, NULL,
php3_info_temp_printf ,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL
DLEXPORT php3_module_entry *get_module(void) { return &temp_printf__module_entry
;}
#endif
void php3_info_temp_printf(void)
{
php3_printf("$Revision : 1.1$\n") ;
}
void php3_temp_printf_func(INTERNAL_FUNCTION_PARAMETERS)
{
int ret = 0 ;
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
add_assoc_string(return_value, "1===>", "hello world!!!", strlen("hello world!!!"));
add_assoc_string(return_value, "2===>", "1234567890---abc?", strlen("1234567890---abc?")) ;
}
//////////////////////header source //////////////////////
#ifndef PHP_TEMP_PRINTF
#define PHP_TEMP_PRINTF
#ifndef DLEXPORT
#define DLEXPORT
#endif
extern php3_module_entry temp_printf_module_entry ;
#define temp_printf_module_ptr &temp_printf_module_entry
extern void php3_info_temp_printf(void) ;
extern void php3_temp_printf_func(INTERNAL_FUNCTION_PARAMETERS) ;
#endif
///////////////////////////////////////////////////////
<?
$id = posix_getpid() ;
echo "Currtent pid : $id<br>\n" ;
$exif = posix_tempprintf() ;
while(list($k, $v) = each($exif))
{
echo "$k : $v<br>\n" ;
}
?>
Currtent pid : 13534
Fatal error: Call to unsupported or undefined function posix_tempprintf() in /www/htdocs/temp_test.php3 on line 5