pike.git / src / dynamic_load.c

version» Context lines:

pike.git/src/dynamic_load.c:1:   #ifndef TESTING   # include "global.h"   # include "interpret.h"   # include "constants.h"   # include "error.h"   # include "module.h"   # include "stralloc.h"   # include "pike_macros.h"   # include "main.h"    - RCSID("$Id: dynamic_load.c,v 1.35 1999/04/15 04:08:13 hubbe Exp $"); + RCSID("$Id: dynamic_load.c,v 1.36 1999/04/25 21:07:16 grubba Exp $");      #endif /* !TESTING */      #ifdef HAVE_ERRNO_H   #include <errno.h>   #endif /* HAVE_ERRNO_H */   #ifdef HAVE_STRING_H   #include <string.h>   #endif /* HAVE_STRING_H */   
pike.git/src/dynamic_load.c:218: Inside #if undefined(TESTING) and #if defined(HAVE_DLOPEN) || defined(USE_DLD) || defined(USE_HPUX_DL)
     struct module_list   {    struct module_list * next;    void *module;    modfun init, exit;   };      struct module_list *dynamic_module_list = 0;    + #ifdef NO_CAST_TO_FUN + /* Function pointers can't be casted to scalar pointers according to +  * ISO-C (probably to support true Harward achitecture machines). +  */ + static modfun CAST_TO_FUN(void *ptr) + { +  union { +  void *ptr; +  modfun fun; +  } u; +  u.ptr = ptr; +  return u.fun; + } + #else /* !NO_CAST_TO_FUN */ + #define CAST_TO_FUN(X) ((modfun)X) + #endif /* NO_CAST_TO_FUN */ +    void f_load_module(INT32 args)   {    void *module;    modfun init, exit;    struct module_list *new_module;    const char *module_name;       if(sp[-args].type != T_STRING)    error("Bad argument 1 to load_module()\n");   
pike.git/src/dynamic_load.c:245: Inside #if undefined(TESTING) and #if defined(HAVE_DLOPEN) || defined(USE_DLD) || defined(USE_HPUX_DL)
   const char *err = dlerror();    if(!err) err = "Unknown reason";    if (sp[-args].u.string->len < 1024) {    error("load_module(\"%s\") failed: %s\n",    sp[-args].u.string->str, err);    } else {    error("load_module() failed: %s\n", err);    }    }    -  init=(modfun)dlsym(module, "pike_module_init"); +  init = CAST_TO_FUN(dlsym(module, "pike_module_init"));    if (!init) { -  init=(modfun)dlsym(module, "_pike_module_init"); +  init = CAST_TO_FUN(dlsym(module, "_pike_module_init"));    } -  exit=(modfun)dlsym(module, "pike_module_exit"); +  exit = CAST_TO_FUN(dlsym(module, "pike_module_exit"));    if (!exit) { -  exit=(modfun)dlsym(module, "_pike_module_exit"); +  exit = CAST_TO_FUN(dlsym(module, "_pike_module_exit"));    }       if(!init || !exit)    {    dlclose(module);       if (strlen(module_name) < 1024) {    error("Failed to initialize dynamic module \"%s\".\n", module_name);    } else {    error("Failed to initialize dynamic module.\n");