Hi,
i am trying to build a custom extension for PHP in a win32 environment
(W2K, MSVC 6.0, german, all service packs).

I am trying to set a global variable in the MINIT function.
I basically just cut&pasted the stuff from the API docs.

PHP_MINIT_FUNCTION(myext)
{
zval *new_var1, *new_var2;

// If you have INI entries, uncomment these lines
ZEND_INIT_MODULE_GLOBALS(myext, php_myext_init_globals, NULL);

REGISTER_INI_ENTRIES();
// TSRMLS_FETCH();
MAKE_STD_ZVAL(new_var1);
ZVAL_LONG(new_var1, 10);
ZEND_SET_SYMBOL(&EG(symbol_table), "MYLONG", new_var1);

return SUCCESS;
}

When doing the compile/link, i get the following output from MSVC:

Linker-Vorgang läuft...
Bibliothek Release_TS/php_myext.lib und Objekt
Release_TS/php_myext.exp wird erstellt
php_myext.obj : error LNK2001: Nichtaufgeloestes externes Symbol
_executor_globals_id
php_myext.dll : fatal error LNK1120: 1 unaufgeloeste externe Verweise
Fehler beim Ausführen von link.exe.

php_myext.dll - 2 Fehler, 1 Warnung(en)

I downloaded the PHP 4.39 source tarball and recompiled most
pieces before.

I suspect it has to do with ZTS thing, but i didn't find any
information if this is set on Windows (i assume so) or where
it is configured (and why) ?

Does anyone have bullet-proof instrcutions how to build a custom
extension under win32 ?

Any other pointers to resolve this task are appreciated !

Thanks
Hi,
i am trying to build a custom extension for PHP in a win32 environment
(W2K, MSVC 6.0, german, all service packs).

I am trying to set a global variable in the MINIT function.
I basically just cut&pasted the stuff from the API docs.

PHP_MINIT_FUNCTION(myext)
{
zval *new_var1, *new_var2;

// If you have INI entries, uncomment these lines
ZEND_INIT_MODULE_GLOBALS(myext, php_myext_init_globals, NULL);

REGISTER_INI_ENTRIES();
// TSRMLS_FETCH();
MAKE_STD_ZVAL(new_var1);
ZVAL_LONG(new_var1, 10);
ZEND_SET_SYMBOL(&EG(symbol_table), "MYLONG", new_var1);

return SUCCESS;
}

When doing the compile/link, i get the following output from MSVC:

Linker-Vorgang läuft...
Bibliothek Release_TS/php_myext.lib und Objekt
Release_TS/php_myext.exp wird erstellt
php_myext.obj : error LNK2001: Nichtaufgeloestes externes Symbol
_executor_globals_id
php_myext.dll : fatal error LNK1120: 1 unaufgeloeste externe Verweise
Fehler beim Ausführen von link.exe.

php_myext.dll - 2 Fehler, 1 Warnung(en)

I downloaded the PHP 4.39 source tarball and recompiled most
pieces before.

I suspect it has to do with ZTS thing, but i didn't find any
information if this is set on Windows (i assume so) or where
it is configured (and why) ?

Does anyone have bullet-proof instrcutions how to build a custom
extension under win32 ?

Any other pointers to resolve this task are appreciated !

Thanks