pike.git / src / dynamic_load.c

version» Context lines:

pike.git/src/dynamic_load.c:15:   # include "interpret.h"   # include "constants.h"   # include "pike_error.h"   # include "module.h"   # include "stralloc.h"   # include "pike_macros.h"   # include "main.h"   # include "constants.h"   # include "lex.h"   # include "object.h" + # include "cyclic.h"      #else /* TESTING */      #include <stdio.h>   #include <string.h>      #endif /* !TESTING */      #include <errno.h>   
pike.git/src/dynamic_load.c:434:    *!    *! @note    *! The current working directory is normally not searched for    *! dynamic modules. Please use @expr{"./name.so"@} instead of just    *! @expr{"name.so"@} to load modules from the current directory.    */   void f_load_module(INT32 args)   {    extern int global_callable_flags;    -  void *module; +  void *module = NULL;    modfun init, exit;    struct module_list *new_module;    struct pike_string *module_name;       ONERROR err; -  +  DECLARE_CYCLIC();       module_name = Pike_sp[-args].u.string;       if((TYPEOF(Pike_sp[-args]) != T_STRING) ||    (module_name->size_shift) ||    string_has_null(module_name)) {    Pike_error("Bad argument 1 to load_module()\n");    }       {    struct module_list *mp;    for (mp = dynamic_module_list; mp; mp = mp->next)    if (mp->name == module_name && mp->module_prog) {    pop_n_elems(args);    ref_push_program(mp->module_prog);    return;    }    }    -  +  if (!BEGIN_CYCLIC(module_name, 0)) { +  SET_CYCLIC_RET(1); +     /* Removing RTLD_GLOBAL breaks some PiGTK themes - Hubbe */    /* Using RTLD_LAZY is faster, but makes it impossible to    * detect linking problems at runtime..    */    module=dlopen(module_name->str,    RTLD_NOW /*|RTLD_GLOBAL*/ ); -  +  }       if(!module)    {    struct object *err_obj = fast_clone_object(module_load_error_program);   #define LOADERR_STRUCT(OBJ) \    ((struct module_load_error_struct *) (err_obj->storage + module_load_error_offset))       const char *err = dlerror();    if (err) {    if (err[strlen (err) - 1] == '\n')
pike.git/src/dynamic_load.c:597: Inside #if defined(PIKE_DEBUG)
   if(Pike_sp != save_sp)    Pike_fatal("pike_module_exit in %s left "    "%"PRINTPTRDIFFT"d droppings on stack.\n",    module_name->str, Pike_sp - save_sp);   #endif       dlclose(module);    dynamic_module_list = new_module->next;    free_string(new_module->name);    free(new_module); +  END_CYCLIC();    Pike_error("Failed to initialize dynamic module \"%S\".\n",    module_name);    }    } -  +  END_CYCLIC();   }      #endif /* USE_DYNAMIC_MODULES */         void init_dynamic_load(void)   {   #ifdef USE_DYNAMIC_MODULES    if (dlinit()) {