Re: [php-gtk-cvs] cvs: php-gtk(SO_BUILD_SYSTEM_BRANCH) /main php_gtk.c

From: Date: Fri, 16 Nov 2001 22:50:49 +0000
Subject: Re: [php-gtk-cvs] cvs: php-gtk(SO_BUILD_SYSTEM_BRANCH) /main php_gtk.c
Groups: php.gtk.cvs 
Request: Send a blank email to php-gtk-cvs+get-308@lists.php.net to get a copy of this message
Hi Andrew, Great work. Let me know when you have something working and I'll start working on it on Win32 so we can release at the same time. - Frank > andrei Fri Nov 16 16:55:41 2001 EDT > > Modified files: (Branch: SO_BUILD_SYSTEM_BRANCH) > /php-gtk/main php_gtk.c > Log: > Started work on the loading of dynamic extensions. > > > Index: php-gtk/main/php_gtk.c > diff -u php-gtk/main/php_gtk.c:1.24 php-gtk/main/php_gtk.c:1.24.2.1 > --- php-gtk/main/php_gtk.c:1.24 Wed Oct 17 12:48:48 2001 > +++ php-gtk/main/php_gtk.c Fri Nov 16 16:55:41 2001 > @@ -18,13 +18,25 @@ > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > > -/* $Id: php_gtk.c,v 1.24 2001/10/17 16:48:48 andrei Exp $: */ > +/* $Id: php_gtk.c,v 1.24.2.1 2001/11/16 21:55:41 andrei Exp $: */ > > #include "php_gtk.h" > #include "SAPI.h" > > #if HAVE_PHP_GTK > > +#ifndef PHP_WIN32 > +#include "build-defs.h" > +#endif > +#ifdef PHP_WIN32 > +#include "win32/param.h" > +#include "win32/winutil.h" > +#define GET_DL_ERROR() php_win_err() > +#else > +#include <sys/param.h> > +#define GET_DL_ERROR() dlerror() > +#endif > + > HashTable php_gtk_ext_registry; > GHashTable *php_gtk_class_hash = NULL; > > @@ -51,8 +63,11 @@ > ZEND_GET_MODULE(gtk) > #endif > > +static void php_gtk_startup_shared_extensions(int module_number); > + > PHP_INI_BEGIN() > STD_PHP_INI_ENTRY ("php-gtk.codepage", > "CP1252", PHP_INI_SYSTEM, OnUpdateString, codepage, zend_gtk_globals, gtk_globals) > + PHP_INI_ENTRY ("php-gtk.extensions", NULL, PHP_INI_SYSTEM, NULL) > PHP_INI_END() > > > @@ -96,10 +111,12 @@ > zend_set_timeout(0); > > if (php_gtk_startup_all_extensions(module_number) == FAILURE) { > - php_error(E_WARNING, "Unable to start extensions"); > + php_error(E_WARNING, "Unable to start internal extensions"); > return FAILURE; > } > > + php_gtk_startup_shared_extensions(module_number); > + > return SUCCESS; > } > > @@ -176,6 +193,61 @@ > } > > return SUCCESS; > +} > + > +static void php_gtk_dl(char *ext_name) > +{ > + char *extension_dir, *libpath; > + int ext_name_len = strlen(ext_name); > + void *handle; > + > + if (cfg_get_string("extension_dir", &extension_dir) == FAILURE) { > + extension_dir = PHP_EXTENSION_DIR; > + } > + > + if (extension_dir && extension_dir[0]) { > + int extension_dir_len = strlen(extension_dir); > + > + libpath = emalloc(extension_dir_len + ext_name_len + 2); > + > + if (IS_SLASH(extension_dir[extension_dir_len-1])) { > + sprintf(libpath, "%s%s", extension_dir, ext_name); /* SAFE */ > + } else { > + sprintf(libpath, "%s/%s", extension_dir, ext_name); /* SAFE */ > + } > + } else { > + libpath = estrndup(ext_name, ext_name_len); > + } > + > + php_printf("path: %s\n", libpath); > + handle = DL_LOAD(libpath); > + if (!handle) { > + php_error(E_WARNING, "Unable to load shared PHP-GTK extension '%s' - > '%s'", libpath, GET_DL_ERROR()); > + efree(libpath); > + return; > + } > + > + efree(libpath); > +} > + > +static void php_gtk_startup_shared_extensions(int module_number) > +{ > + zval exts_val; > + char *exts; > + char *ext_name; > + > + if (zend_get_configuration_directive("php-gtk.extensions", > + sizeof("php-gtk.extensions"), &exts_val) == FAILURE) > + return; > + > + exts = estrndup(Z_STRVAL(exts_val), Z_STRLEN(exts_val)); > + > + ext_name = strtok(exts, ", "); > + while (ext_name) { > + php_gtk_dl(ext_name); > + ext_name = strtok(NULL, ", "); > + } > + efree(exts); > } > > #endif /* HAVE_PHP_GTK */ > > > > -- > PHP-GTK CVS Mailing List (http://gtk.php.net/) > To unsubscribe, e-mail: php-gtk-cvs-unsubscribe@lists.php.net > For additional commands, e-mail: php-gtk-cvs-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.gtk.cvs (#308) next »