[PHP-DEV] extension not shutting down on each request

2001-07-25 Thread Gilles Koffmann

Hi,

I'm working on an extension with PHP 4.06, VC++6 and doing OO syntax
overloading.

It seems that on termination of a script the PHP_MSHUTDOWN_FUNCTION is not
called.

However the doc at www.zend.com says :

... As dynamic loadable modules are loaded only on page requests, the
request shutdown function is immediately followed by a call to the module
shutdown handler (both deinitialization events happen at the same time)... 

Did I miss something ?

Thank's

Gilles





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] problem with ressources on reload

2001-07-25 Thread Gilles Koffmann

Hi,

I'm writing an extension PHP 4.06, VC++6 and doing OO syntax overloading and
ZTS

I'm using a global struct that is defined as ZTS global

typedef struct {
 HashTable *array_dl_handle;
 HashTable *array_compiler;
} php_delphi_globals;


I'm using a ressource. This ressource is created as :
...
typedef struct {
 void * handle;
 CREATEOBJECT GetObject;
 GETCOMPILER GetCompiler;
 DESTROYOBJECT DestroyObject;
 char *module_name;
} php_delphi_user;

...
le_pdu = zend_register_list_destructors_ex(NULL, NULL, delphi_pdu,
module_number);
...

This ressource once created is added to the global Hashtable
array_dl_handle:

pdu =  emalloc(sizeof(php_delphi_user));
MAKE_STD_ZVAL(pdu_handle);
 ZVAL_LONG(pdu_handle, zend_list_insert(pdu, le_pdu));

 zend_hash_add(DG(array_dl_handle)
,module_name,strlen(module_name),pdu_handle,sizeof(zval *),NULL);


On first request everything goes fine. I can access my ressource.
On second request with the same script, when I do

if (zend_hash_find(DG(array_dl_handle), module_name,strlen(module_name),
(void **)value) == SUCCESS) {
pdu = zend_list_find((*value)-value.lval, type) ;
}
, pdu is false.

Does ressources survive between requests ?
Is it mandatory to use the ressource feature to create structures ?
What am I doing wrong ?

Thank's

Gilles






-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] extension crashes on reload

2001-07-20 Thread Gilles Koffmann

Hi,

I'm writing an extension to access Delphi, C++ builder and Kylix objects.

PHP 4.0.6, Win98, VC++6 sp5

My extension crashes (page fault in Kernel32.dll) when I reload my script
(2nde execution).

What could cause this crash ? Thank's.

Gilles



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] extensions

2001-07-13 Thread Gilles Koffmann

Hi,

on win98 Apache php 4.0.6 as a module and  VC++6

When Apache starts I have the following execution in my extension :

PHP_MINIT_FUNCTION()
PHP_MSHUTDOWN_FUNCTION()
PHP_MINIT_FUNCTION()

Why ?

Gilles







-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Problem with globals ZTS

2001-07-09 Thread Gilles Koffmann

Hi derick,

I did not know about that, since I could compile and work on my project for
a while until this problem appear.

So I should by VC++6 ?

Gilles

- Message d'origine -
De : [EMAIL PROTECTED]
À : Gilles Koffmann [EMAIL PROTECTED]
Cc : Zeev Suraski [EMAIL PROTECTED]; PHP Developers Mailing List
[EMAIL PROTECTED]
Envoyé : jeudi 5 juillet 2001 09:02
Objet : Re: [PHP-DEV] Problem with globals ZTS


 On Thu, 5 Jul 2001, Gilles Koffmann wrote:

  Hello,
 
  I'm in ZTS mode. Building with VC++ 5, on win 98 with PHP 4.0.5 and
apache
  1.3.19.

 Is VC++ 5 supported? I thought you needed at least version 6...

 Derick

 -
 PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
  SRM: Site Resource Manager - www.vl-srm.net
 -



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Problem with globals ZTS

2001-06-22 Thread Gilles Koffmann

Hi,

I'm writing an extension to php. After changing my code to have thread safe
globals ,
my extension is crashing and I can't figure out what it is:

typedef struct {
 HashTable array_dl_handle; /* hash user dll name - handle, getobject,
getcompiler, destroyobject */
 HashTable array_compiler;  /* hash compiler name - handle, gps, gms,
version */
} php_delphi_globals;

#ifdef ZTS
#define DG(v) (delphi_globals-v)
#define DG_FETCH() php_delphi_globals *delphi_globals =
ts_resource(delphi_globals_id)
#define DG_D   php_delphi_globals *delphi_globals
#define DG_DC  , DG_D
#define DG_C   delphi_globals
#define DG_CC  , DG_C
int delphi_globals_id;
#else
#define DG(v) (delphi_globals.v)
#define DG_FETCH()
#define DG_D
#define DG_DC
#define DG_C
#define DG_CC
php_delphi_globals delphi_globals;
#endif

#ifdef ZTS
static void alloc_delphi_globals_ctor(php_delphi_globals *delphi_globals) {
  memset(delphi_globals, 0, sizeof(php_delphi_globals));
}
#endif

ZEND_MINIT_FUNCTION(delphi) {
#ifdef ZTS
  delphi_globals_id = ts_allocate_id(sizeof(php_delphi_globals),
(ts_allocate_ctor)alloc_delphi_globals_ctor, NULL);
#endif
...

 DG_FETCH();
 zend_hash_init(DG(array_dl_handle), 0, NULL, NULL, 0);
 zend_hash_init(DG(array_compiler), 0, NULL, NULL, 0);

}

It crashes when I do in one function:

DG_FETCH();
zend_hash_find(DG(array_dl_handle), module_name,strlen(module_name)+1,
(void **)value);

My hashtable is empty.
When array_dl_handle was not part of ZTS globals, everything was OK. Any
clue ?

Gilles.




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]