Bug #13266 Updated: Maybe not a PHP Library ?
| From: | hholzgra@php.net | Date: | Thu, 13 Sep 2001 06:02:24 +0000 |
| Subject: | Bug #13266 Updated: Maybe not a PHP Library ? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-65857@lists.php.net to get a copy of this message | ||
ID: 13266
Updated by: hholzgra
Reported By: atur@vigorsoft.com
Status: Bogus
Bug Type: Dynamic loading
Operating System: Windows NT 4.0
PHP Version: 4.0.6
New Comment:
once again: ask the phpdev mailing list, please
supscription information can be found
on http://php.net/support.php
Previous Comments:
------------------------------------------------------------------------
[2001-09-13 01:43:30] atur@vigorsoft.com
Hi,
The module entry is in the source..
I am pasting header and source file for reference..
---------------------------------------------------------------------------
/* ------------------------------------------ */
/* php_mymodule.h --- after removing comments */
/* ------------------------------------------ */
#ifndef PHP_MYMODULE_H
#define PHP_MYMODULE_H
extern zend_module_entry mymodule_module_entry;
#define phpext_mymodule_ptr &mymodule_module_entry
#ifdef PHP_WIN32
#define PHP_MYMODULE_API __declspec(dllexport)
#else
#define PHP_MYMODULE_API
#endif
extern "C"
{
PHP_FUNCTION(confirm_mymodule_compiled);
}
#ifdef ZTS
#define MYMODULE_G(v) (mymodule_globals->v)
#define MYMODULE_LS_FETCH() zend_mymodule_globals *mymodule_globals =
ts_resource(mymodule_globals_id)
#else
#define MYMODULE_G(v) (mymodule_globals.v)
#define MYMODULE_LS_FETCH()
#endif
#endif /* PHP_MYMODULE_H */
/* ------------------------------------------ */
/* mymodule.cpp --- after removing comments */
/* ------------------------------------------ */
#define DHAVE_APDEBUG 1
#define DCOMPILE_DL_APDEBUG 1
#define ZTS 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include <iostream.h>
extern "C"
{
#include "ext/standard/info.h"
#include "php_globals.h"
#include "php_ini.h"
#include "php_mymodule.h"
}
/* True global resources - no need for thread safety here */
static int le_mymodule;
/* Every user visible function must have an entry in mymodule_functions[]. */
function_entry mymodule_functions[] = {
PHP_FE(confirm_mymodule_compiled,NULL)
{NULL, NULL, NULL}
};
zend_module_entry mymodule_module_entry = {
"mymodule",
mymodule_functions,
NULL,NULL,NULL,NULL,NULL,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_MYMODULE
extern "C"
{
ZEND_GET_MODULE(mymodule)
}
#endif
PHP_FUNCTION(confirm_mymodule_compiled)
{
zval **arg;
int len;
char string[256];
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE)
{WRONG_PARAM_COUNT;}
convert_to_string_ex(arg);
len = sprintf(string, "Congratulations! You have successfully modified ext/%.78s/config.m4.
Module %.78s is now compiled into PHP.", "mymodule", Z_STRVAL_PP(arg));
RETURN_STRINGL(string, len, 1);
}
---------------------------------------------------------------------------
Regards,
Atur Shah
------------------------------------------------------------------------
[2001-09-12 12:26:30] mfischer@php.net
Make sure your module entry is in the source
#ifdef COMPILE_DL_YOURMODULE
ZEND_GET_MODULE(yourmodule)
#endif
- Markus
------------------------------------------------------------------------
[2001-09-12 11:51:17] hholzgra@php.net
support problem and most likely not a bug (at least not enough info to find out), please ask the
phpdev mailing list (and give more info)
------------------------------------------------------------------------
[2001-09-12 11:40:45] atur@vigorsoft.com
HI,
I am trying to load newly made PHP extension module (C++).
(e.g. mymodule.dll) using dl().
The error when accessing PHP file in browser with Apache Web Server is :
"Invalid Library (Maybe not a PHP Library) mymodule.dll"
I used these configurations :
PHP 4.0.6
Apache 1.3.20
Windows NT 4.0
Visual C++ 6.0
Comments Please.
Thanks.
Atur Shah.
(aturshah@hotmail.com)
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13266&edit=1