Are you building it in ZTS mode or does it crash in non ZTS mode after this 

At 09:35 22/6/2001, Gilles Koffmann wrote:
>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 =
>#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;
>#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;
>#ifdef ZTS
>static void alloc_delphi_globals_ctor(php_delphi_globals *delphi_globals) {
>   memset(delphi_globals, 0, sizeof(php_delphi_globals));
>#ifdef ZTS
>   delphi_globals_id = ts_allocate_id(sizeof(php_delphi_globals),
>     (ts_allocate_ctor)alloc_delphi_globals_ctor, NULL);
>  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:
>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 ?
>PHP Development Mailing List <>
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd.

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to