Skip to content
Snippets Groups Projects
Select Git revision
  • 94d66be375b108c61bd05fc08b59e87c6d8fc81c
  • master default protected
  • 8.0
  • 9.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2008
  • v8.0.2006
  • v8.0.2004
  • v8.0.2002
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
41 results

cyclic.h

Blame
  • dynamic_load.c 6.62 KiB
    #include "global.h"
    
    #if !defined(HAVE_DLSYM) || !defined(HAVE_DLOPEN)
    #undef HAVE_DLOPEN
    #endif
    
    #if !defined(HAVE_DLOPEN) && defined(HAVE_DLD_LINK) && defined(HAVE_DLD_GET_FUNC)
    #define USE_DLD
    #endif
    
    #if 1
    
    #if defined(HAVE_DLOPEN) || defined(USE_DLD)
    #include "interpret.h"
    #include "constants.h"
    #include "error.h"
    #include "module.h"
    #include "stralloc.h"
    #include "macros.h"
    
    #ifdef HAVE_DLFCN_H
    #include <dlfcn.h>
    #endif
    
    #ifdef HAVE_DLD_H
    #include <dld.h>
    #endif
    
    typedef void (*modfun)(void);
    
    struct module_list
    {
      struct module_list * next;
      void *module;
      modfun init, exit;
    };
    
    struct module_list *dynamic_module_list = 0;
    
    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");
    
      module_name = sp[-args].u.string->str;
    
    #ifdef HAVE_DLOPEN
    
    #ifndef RTLD_NOW
    #define RTLD_NOW 0
    #endif
      module=dlopen(module_name, RTLD_NOW);
      if(!module)
      {
        error("load_module(\"%s\") failed: %s\n",
    	  sp[-args].u.string->str, dlerror());
      }
    #elif defined(USE_DLD)
      dld_create_reference("pike_module_init");
      if (dld_link(module_name)) {
          error("load_module(\"%s\") failed: %s\n",
    	    module_name, dld_strerror(dld_errno));
      }
      module=strdup(module_name);
    #endif /* HAVE_DLOPEN */