pike.git / src / dynamic_load.c

version» Context lines:

pike.git/src/dynamic_load.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: dynamic_load.c,v 1.71 2003/12/10 14:42:39 grubba Exp $ + || $Id: dynamic_load.c,v 1.72 2004/03/22 17:41:00 mast Exp $   */      #ifdef TESTING   #define NO_PIKE_INCLUDES   #define CREATE_MAIN   #define NO_PIKE_GUTS   #endif      #ifndef NO_PIKE_INCLUDES   # 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"   # include "language.h"   # include "lex.h" -  + # include "object.h"    - RCSID("$Id: dynamic_load.c,v 1.71 2003/12/10 14:42:39 grubba Exp $"); + RCSID("$Id: dynamic_load.c,v 1.72 2004/03/22 17:41:00 mast 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:397:       /* 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,    RTLD_NOW /*|RTLD_GLOBAL*/ );       if(!module)    { +  struct object *err_obj = low_clone (dlopen_error_program); + #define DLERR_STRUCT(OBJ) \ +  ((struct dlopen_error_struct *) (err_obj->storage + dlopen_error_offset)) +     const char *err = dlerror(); -  if(!err) err = "Unknown reason"; +  if (err) { +  if (err[strlen (err) - 1] == '\n') +  push_string (make_shared_binary_string (err, strlen (err) - 1)); +  else +  push_text (err); +  } +  else +  push_constant_text ("Unknown reason"); +  +  add_ref (DLERR_STRUCT (err_obj)->path = Pike_sp[-args - 1].u.string); +  add_ref (DLERR_STRUCT (err_obj)->dlerror = Pike_sp[-1].u.string); +     if (Pike_sp[-args].u.string->len < 1024) { -  Pike_error("load_module(\"%s\") failed: %s\n", -  Pike_sp[-args].u.string->str, err); +  throw_error_object (err_obj, "load_module", Pike_sp - args - 1, args, +  "load_module(\"%s\") failed: %s\n", +  module_name, Pike_sp[-1].u.string->str);    } else { -  Pike_error("load_module() failed: %s\n", err); +  throw_error_object (err_obj, "load_module", Pike_sp - args - 1, args, +  "load_module() failed: %s\n", +  Pike_sp[-1].u.string->str);    }    }       {    struct module_list *mp;    for (mp = dynamic_module_list; mp; mp = mp->next)    if (mp->module == module && mp->module_prog) {    pop_n_elems(args);    ref_push_program(mp->module_prog);    return;