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.80 2004/04/14 19:05:26 grubba Exp $ + || $Id: dynamic_load.c,v 1.81 2004/04/14 19:45:15 mast Exp $   */      #ifdef TESTING   #define NO_PIKE_INCLUDES   #define CREATE_MAIN   #define NO_PIKE_GUTS   #endif      #ifndef NO_PIKE_INCLUDES   # include "global.h"
pike.git/src/dynamic_load.c:17:   # 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"    - RCSID("$Id: dynamic_load.c,v 1.80 2004/04/14 19:05:26 grubba Exp $"); + RCSID("$Id: dynamic_load.c,v 1.81 2004/04/14 19:45:15 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:503: Inside #if defined(PIKE_DEBUG)
   pop_n_elems(args);    ref_push_program(mp->module_prog);    return;    }    }   #endif /* PIKE_DEBUG */       init = CAST_TO_FUN(dlsym(module, "pike_module_init"));    if (!init) {    init = CAST_TO_FUN(dlsym(module, "_pike_module_init")); +  if (!init) { +  dlclose(module); +  if (!module_name->size_shift && module_name->len < 1024) { +  Pike_error("pike_module_init missing in dynamic module \"%s\".\n", +  module_name->str); +  } else { +  Pike_error("pike_module_init missing in dynamic module.\n");    } -  +  } +  } +     exit = CAST_TO_FUN(dlsym(module, "pike_module_exit"));    if (!exit) {    exit = CAST_TO_FUN(dlsym(module, "_pike_module_exit")); -  } -  -  if(!init || !exit) -  { +  if (!exit) {    dlclose(module); -  -  if (strlen(module_name->str) < 1024) { -  Pike_error("Failed to initialize dynamic module \"%s\".\n", +  if (!module_name->size_shift && module_name->len < 1024) { +  Pike_error("pike_module_exit missing in dynamic module \"%s\".\n",    module_name->str);    } else { -  Pike_error("Failed to initialize dynamic module.\n"); +  Pike_error("pike_module_exit missing in dynamic module.\n");    }    } -  +  } +    #if defined(__NT__) && defined(_M_IA64) -  else +     {    fprintf(stderr, "pike_module_init: 0x%p\n"    " func: 0x%p\n"    " gp: 0x%p\n",    init, ((void **)init)[0], ((void **)init)[1]);    fprintf(stderr, "pike_module_exit: 0x%p\n"    " func: 0x%p\n"    " gp: 0x%p\n",    exit, ((void **)exit)[0], ((void **)exit)[1]);    }