"Fossies" - the Fresh Open Source Software Archive

Member "dmd2/src/druntime/import/core/sys/posix/dlfcn.d" (20 Nov 2020, 8522 Bytes) of package /linux/misc/dmd.2.094.2.linux.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) D source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /**
    2  * D header file for POSIX.
    3  *
    4  * Copyright: Copyright Sean Kelly 2005 - 2009.
    5  * License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
    6  * Authors:   Sean Kelly, Alex Rønne Petersen
    7  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
    8  */
    9 
   10 /*          Copyright Sean Kelly 2005 - 2009.
   11  * Distributed under the Boost Software License, Version 1.0.
   12  *    (See accompanying file LICENSE or copy at
   13  *          http://www.boost.org/LICENSE_1_0.txt)
   14  */
   15 module core.sys.posix.dlfcn;
   16 
   17 private import core.sys.posix.config;
   18 
   19 version (OSX)
   20     version = Darwin;
   21 else version (iOS)
   22     version = Darwin;
   23 else version (TVOS)
   24     version = Darwin;
   25 else version (WatchOS)
   26     version = Darwin;
   27 
   28 version (ARM)     version = ARM_Any;
   29 version (AArch64) version = ARM_Any;
   30 version (HPPA)    version = HPPA_Any;
   31 version (MIPS32)  version = MIPS_Any;
   32 version (MIPS64)  version = MIPS_Any;
   33 version (PPC)     version = PPC_Any;
   34 version (PPC64)   version = PPC_Any;
   35 version (RISCV32) version = RISCV_Any;
   36 version (RISCV64) version = RISCV_Any;
   37 version (S390)    version = IBMZ_Any;
   38 version (SPARC)   version = SPARC_Any;
   39 version (SPARC64) version = SPARC_Any;
   40 version (SystemZ) version = IBMZ_Any;
   41 version (X86)     version = X86_Any;
   42 version (X86_64)  version = X86_Any;
   43 
   44 version (Posix):
   45 extern (C):
   46 nothrow:
   47 @nogc:
   48 @system:
   49 
   50 //
   51 // XOpen (XSI)
   52 //
   53 /*
   54 RTLD_LAZY
   55 RTLD_NOW
   56 RTLD_GLOBAL
   57 RTLD_LOCAL
   58 
   59 int   dlclose(void*);
   60 char* dlerror();
   61 void* dlopen(const scope char*, int);
   62 void* dlsym(void*, const scope char*);
   63 */
   64 
   65 version (CRuntime_Glibc)
   66 {
   67     version (X86_Any)
   68     {
   69         enum RTLD_LAZY      = 0x00001;
   70         enum RTLD_NOW       = 0x00002;
   71         enum RTLD_GLOBAL    = 0x00100;
   72         enum RTLD_LOCAL     = 0x00000;
   73     }
   74     else version (HPPA_Any)
   75     {
   76         enum RTLD_LAZY      = 0x0001;
   77         enum RTLD_NOW       = 0x0002;
   78         enum RTLD_GLOBAL    = 0x0100;
   79         enum RTLD_LOCAL     = 0;
   80     }
   81     else version (MIPS_Any)
   82     {
   83         enum RTLD_LAZY      = 0x0001;
   84         enum RTLD_NOW       = 0x0002;
   85         enum RTLD_GLOBAL    = 0x0004;
   86         enum RTLD_LOCAL     = 0;
   87     }
   88     else version (PPC_Any)
   89     {
   90         enum RTLD_LAZY      = 0x00001;
   91         enum RTLD_NOW       = 0x00002;
   92         enum RTLD_GLOBAL    = 0x00100;
   93         enum RTLD_LOCAL     = 0;
   94     }
   95     else version (ARM_Any)
   96     {
   97         enum RTLD_LAZY      = 0x00001;
   98         enum RTLD_NOW       = 0x00002;
   99         enum RTLD_GLOBAL    = 0x00100;
  100         enum RTLD_LOCAL     = 0;
  101     }
  102     else version (RISCV_Any)
  103     {
  104         enum RTLD_LAZY      = 0x00001;
  105         enum RTLD_NOW       = 0x00002;
  106         enum RTLD_GLOBAL    = 0x00100;
  107         enum RTLD_LOCAL     = 0;
  108     }
  109     else version (SPARC_Any)
  110     {
  111         enum RTLD_LAZY      = 0x00001;
  112         enum RTLD_NOW       = 0x00002;
  113         enum RTLD_GLOBAL    = 0x00100;
  114         enum RTLD_LOCAL     = 0;
  115     }
  116     else version (IBMZ_Any)
  117     {
  118         enum RTLD_LAZY      = 0x00001;
  119         enum RTLD_NOW       = 0x00002;
  120         enum RTLD_GLOBAL    = 0x00100;
  121         enum RTLD_LOCAL     = 0;
  122     }
  123     else
  124         static assert(0, "unimplemented");
  125 
  126     int   dlclose(void*);
  127     char* dlerror();
  128     void* dlopen(const scope char*, int);
  129     void* dlsym(void*, const scope char*);
  130 }
  131 else version (Darwin)
  132 {
  133     enum RTLD_LAZY      = 0x00001;
  134     enum RTLD_NOW       = 0x00002;
  135     enum RTLD_GLOBAL    = 0x00100;
  136     enum RTLD_LOCAL     = 0x00000;
  137 
  138     int   dlclose(void*);
  139     char* dlerror();
  140     void* dlopen(const scope char*, int);
  141     void* dlsym(void*, const scope char*);
  142     int   dladdr(void* addr, Dl_info* info);
  143 
  144     struct Dl_info
  145     {
  146         const(char)* dli_fname;
  147         void*        dli_fbase;
  148         const(char)* dli_sname;
  149         void*        dli_saddr;
  150     }
  151 }
  152 else version (FreeBSD)
  153 {
  154     enum RTLD_LAZY      = 1;
  155     enum RTLD_NOW       = 2;
  156     enum RTLD_GLOBAL    = 0x100;
  157     enum RTLD_LOCAL     = 0;
  158 
  159     int   dlclose(void*);
  160     char* dlerror();
  161     void* dlopen(in char*, int);
  162     void* dlsym(void*, in char*);
  163     int   dladdr(const(void)* addr, Dl_info* info);
  164 
  165     struct Dl_info
  166     {
  167         const(char)* dli_fname;
  168         void*        dli_fbase;
  169         const(char)* dli_sname;
  170         void*        dli_saddr;
  171     }
  172 }
  173 else version (NetBSD)
  174 {
  175     enum RTLD_LAZY      = 1;
  176     enum RTLD_NOW       = 2;
  177     enum RTLD_GLOBAL    = 0x100;
  178     enum RTLD_LOCAL     = 0x200;
  179     enum RTLD_NODELETE  = 0x01000;         /* Do not remove members. */
  180     enum RTLD_NOLOAD    = 0x02000;
  181 
  182     int   dlclose(void*);
  183     char* dlerror();
  184     void* dlopen(const scope char*, int);
  185     void* dlsym(void*, const scope char*);
  186     int   dladdr(const(void)* addr, Dl_info* info);
  187 
  188     struct Dl_info
  189     {
  190         const(char)* dli_fname;
  191         void*        dli_fbase;
  192         const(char)* dli_sname;
  193         void*        dli_saddr;
  194     }
  195 }
  196 else version (OpenBSD)
  197 {
  198     enum RTLD_LAZY      = 1;
  199     enum RTLD_NOW       = 2;
  200     enum RTLD_GLOBAL    = 0x100;
  201     enum RTLD_LOCAL     = 0;
  202 
  203     int   dlclose(void*);
  204     char* dlerror();
  205     void* dlopen(const scope char*, int);
  206     void* dlsym(void*, const scope char*);
  207     int   dladdr(const(void)* addr, Dl_info* info);
  208 
  209     struct Dl_info
  210     {
  211         const(char)* dli_fname;
  212         void*        dli_fbase;
  213         const(char)* dli_sname;
  214         void*        dli_saddr;
  215     }
  216 }
  217 else version (DragonFlyBSD)
  218 {
  219     enum RTLD_LAZY      = 1;
  220     enum RTLD_NOW       = 2;
  221     enum RTLD_GLOBAL    = 0x100;
  222     enum RTLD_LOCAL     = 0;
  223 
  224     int   dlclose(void*);
  225     char* dlerror();
  226     void* dlopen(const scope char*, int);
  227     void* dlsym(void*, const scope char*);
  228     int   dladdr(const(void)* addr, Dl_info* info);
  229 
  230     struct Dl_info
  231     {
  232         const(char)* dli_fname;
  233         void*        dli_fbase;
  234         const(char)* dli_sname;
  235         void*        dli_saddr;
  236     }
  237 }
  238 else version (Solaris)
  239 {
  240     enum RTLD_LAZY      = 1;
  241     enum RTLD_NOW       = 2;
  242     enum RTLD_GLOBAL    = 0x100;
  243     enum RTLD_LOCAL     = 0;
  244 
  245     int   dlclose(void*);
  246     char* dlerror();
  247     void* dlopen(const scope char*, int);
  248     void* dlsym(void*, const scope char*);
  249     int   dladdr(const(void)* addr, Dl_info* info);
  250 
  251     struct Dl_info
  252     {
  253         const(char)* dli_fname;
  254         void*        dli_fbase;
  255         const(char)* dli_sname;
  256         void*        dli_saddr;
  257     }
  258 }
  259 else version (CRuntime_Bionic)
  260 {
  261     enum
  262     {
  263         RTLD_NOW    = 0,
  264         RTLD_LAZY   = 1,
  265         RTLD_LOCAL  = 0,
  266         RTLD_GLOBAL = 2
  267     }
  268 
  269     int          dladdr(const scope void*, Dl_info*);
  270     int          dlclose(void*);
  271     const(char)* dlerror();
  272     void*        dlopen(const scope char*, int);
  273     void*        dlsym(void*, const scope char*);
  274 
  275     struct Dl_info
  276     {
  277         const(char)* dli_fname;
  278         void*        dli_fbase;
  279         const(char)* dli_sname;
  280         void*        dli_saddr;
  281     }
  282 }
  283 else version (CRuntime_Musl)
  284 {
  285     enum {
  286         RTLD_LAZY     = 1,
  287         RTLD_NOW      = 2,
  288         RTLD_NOLOAD   = 4,
  289         RTLD_NODELETE = 4096,
  290         RTLD_GLOBAL   = 256,
  291         RTLD_LOCAL    = 0,
  292     }
  293     int          dlclose(void*);
  294     const(char)* dlerror();
  295     void*        dlopen(const scope char*, int);
  296     void*        dlsym(void*, const scope char*);
  297 }
  298 else version (CRuntime_UClibc)
  299 {
  300     version (X86_64)
  301     {
  302         enum RTLD_LAZY              = 0x0001;
  303         enum RTLD_NOW               = 0x0002;
  304         enum RTLD_BINDING_MASK      = 0x3;
  305         enum RTLD_NOLOAD            = 0x00004;
  306         enum RTLD_GLOBAL            = 0x00100;
  307         enum RTLD_LOCAL             = 0;
  308         enum RTLD_NODELETE          = 0x01000;
  309     }
  310     else version (MIPS32)
  311     {
  312         enum RTLD_LAZY              = 0x0001;
  313         enum RTLD_NOW               = 0x0002;
  314         enum RTLD_BINDING_MASK      = 0x3;
  315         enum RTLD_NOLOAD            = 0x00008;
  316         enum RTLD_GLOBAL            = 0x0004;
  317         enum RTLD_LOCAL             = 0;
  318         enum RTLD_NODELETE          = 0x01000;
  319     }
  320     else version (ARM)
  321     {
  322         enum RTLD_LAZY              = 0x0001;
  323         enum RTLD_NOW               = 0x0002;
  324         enum RTLD_BINDING_MASK      = 0x3;
  325         enum RTLD_NOLOAD            = 0x00004;
  326         enum RTLD_GLOBAL            = 0x00100;
  327         enum RTLD_LOCAL             = 0;
  328         enum RTLD_NODELETE          = 0x01000;
  329     }
  330     else
  331         static assert(0, "unimplemented");
  332 
  333     int   dlclose(void*);
  334     char* dlerror();
  335     void* dlopen(const scope char*, int);
  336     void* dlsym(void*, const scope char*);
  337 }