pike.git / src / dynamic_load.c

version» Context lines:

pike.git/src/dynamic_load.c:2:   # include "global.h"   # 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"    - RCSID("$Id: dynamic_load.c,v 1.54 2001/09/10 15:51:23 grubba Exp $"); + RCSID("$Id: dynamic_load.c,v 1.55 2001/09/11 05:42:20 hubbe Exp $");      #else /* TESTING */      #include <stdio.h>      #endif /* !TESTING */      #ifdef HAVE_ERRNO_H   #include <errno.h>   #endif /* HAVE_ERRNO_H */
pike.git/src/dynamic_load.c:338:    *! be called to initialize it. When Pike exits @tt{pike_module_exit()@}    *! will be called. These two functions @b{must@} be available in the module.    *!    *! @note    *! The current working directory is normally not searched for    *! dynamic modules. Please use @tt{"./name.so"@} instead of just    *! @tt{"name.so"@} to load modules from the current directory.    */   void f_load_module(INT32 args)   { +  extern int compilation_depth; +  extern int global_callable_flags; +     void *module;    modfun init, exit;    struct module_list *new_module;    const char *module_name;    -  +  int save_depth=compilation_depth; +     if(sp[-args].type != T_STRING)    Pike_error("Bad argument 1 to load_module()\n");       module_name = sp[-args].u.string->str;       /* 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,
pike.git/src/dynamic_load.c:394:    }    }       new_module=ALLOC_STRUCT(module_list);    new_module->next=dynamic_module_list;    dynamic_module_list=new_module;    new_module->module=module;    new_module->init=init;    new_module->exit=exit;    +  compilation_depth=-1;    start_new_program();    -  { -  extern int global_callable_flags; +     global_callable_flags|=CALLABLE_DYNAMIC; -  } +       #ifdef PIKE_DEBUG    { struct svalue *save_sp=sp;   #endif    (*(modfun)init)();   #ifdef PIKE_DEBUG    if(sp != save_sp)    fatal("load_module(%s) left %ld droppings on stack!\n",    module_name,    PTRDIFF_T_TO_LONG(sp - save_sp));    }   #endif       pop_n_elems(args);    push_program(end_program()); -  +  compilation_depth=save_depth;   }      #endif /* USE_DYNAMIC_MODULES */         void init_dynamic_load(void)   {   #ifdef USE_DYNAMIC_MODULES    if (dlinit()) {