2 * D header file for POSIX.
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
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)
15 module core.sys.posix.dlfcn;
17 import core.sys.posix.config;
25 else version (WatchOS)
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;
60 void* dlopen(const scope char*, int);
61 void* dlsym(void*, const scope char*);
64 version (CRuntime_Glibc)
68 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
69 enum RTLD_LAZY = 0x00001;
70 enum RTLD_NOW = 0x00002;
71 enum RTLD_BINDING_MASK = 0x3;
72 enum RTLD_NOLOAD = 0x00004;
73 enum RTLD_DEEPBIND = 0x00008;
74 enum RTLD_GLOBAL = 0x00100;
75 enum RTLD_LOCAL = 0x00000;
76 enum RTLD_NODELETE = 0x01000;
78 else version (HPPA_Any)
80 // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/hppa/bits/dlfcn.h
81 enum RTLD_LAZY = 0x0001;
82 enum RTLD_NOW = 0x0002;
83 enum RTLD_BINDING_MASK = 0x3;
84 enum RTLD_NOLOAD = 0x00004;
85 enum RTLD_DEEPBIND = 0x00008;
86 enum RTLD_GLOBAL = 0x0100;
88 enum RTLD_NODELETE = 0x01000;
90 else version (MIPS_Any)
92 // http://sourceware.org/git/?p=glibc.git;a=blob;f=ports/sysdeps/mips/bits/dlfcn.h
93 enum RTLD_LAZY = 0x0001;
94 enum RTLD_NOW = 0x0002;
95 enum RTLD_BINDING_MASK = 0x3;
96 enum RTLD_NOLOAD = 0x00008;
97 enum RTLD_DEEPBIND = 0x00010;
98 enum RTLD_GLOBAL = 0x0004;
100 enum RTLD_NODELETE = 0x01000;
102 else version (PPC_Any)
104 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
105 enum RTLD_LAZY = 0x00001;
106 enum RTLD_NOW = 0x00002;
107 enum RTLD_BINDING_MASK = 0x3;
108 enum RTLD_NOLOAD = 0x00004;
109 enum RTLD_DEEPBIND = 0x00008;
110 enum RTLD_GLOBAL = 0x00100;
112 enum RTLD_NODELETE = 0x01000;
114 else version (ARM_Any)
116 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
117 enum RTLD_LAZY = 0x00001;
118 enum RTLD_NOW = 0x00002;
119 enum RTLD_BINDING_MASK = 0x3;
120 enum RTLD_NOLOAD = 0x00004;
121 enum RTLD_DEEPBIND = 0x00008;
122 enum RTLD_GLOBAL = 0x00100;
124 enum RTLD_NODELETE = 0x01000;
126 else version (RISCV_Any)
128 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
129 enum RTLD_LAZY = 0x00001;
130 enum RTLD_NOW = 0x00002;
131 enum RTLD_BINDING_MASK = 0x3;
132 enum RTLD_NOLOAD = 0x00004;
133 enum RTLD_DEEPBIND = 0x00008;
134 enum RTLD_GLOBAL = 0x00100;
136 enum RTLD_NODELETE = 0x01000;
138 else version (SPARC_Any)
140 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
141 enum RTLD_LAZY = 0x00001;
142 enum RTLD_NOW = 0x00002;
143 enum RTLD_BINDING_MASK = 0x3;
144 enum RTLD_NOLOAD = 0x00004;
145 enum RTLD_DEEPBIND = 0x00008;
146 enum RTLD_GLOBAL = 0x00100;
148 enum RTLD_NODELETE = 0x01000;
151 else version (IBMZ_Any)
153 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
154 enum RTLD_LAZY = 0x00001;
155 enum RTLD_NOW = 0x00002;
156 enum RTLD_BINDING_MASK = 0x3;
157 enum RTLD_NOLOAD = 0x00004;
158 enum RTLD_DEEPBIND = 0x00008;
159 enum RTLD_GLOBAL = 0x00100;
161 enum RTLD_NODELETE = 0x01000;
164 static assert(0, "unimplemented");
168 void* dlopen(const scope char*, int);
169 void* dlsym(void*, const scope char*);
170 int dladdr(const scope void*, Dl_info*);
174 const(char)* dli_fname;
176 const(char)* dli_sname;
181 version (CRuntime_Musl)
185 enum RTLD_NOLOAD = 4;
186 enum RTLD_NODELETE = 4096;
187 enum RTLD_GLOBAL = 256;
190 enum RTLD_NEXT = cast(void *)-1;
191 enum RTLD_DEFAULT = cast(void *)0;
193 enum RTLD_DI_LINKMAP = 2;
197 void *dlopen(const(char) *, int);
199 pragma(mangle, muslRedirTime64Mangle!("dlsym", "__dlsym_time64"))
200 void *dlsym(void *__restrict, const(char) *__restrict);
204 const(char)* dli_fname;
206 const(char)* dli_sname;
209 int dladdr(const(void) *, Dl_info *);
210 int dlinfo(void *, int, void *);
212 else version (Darwin)
214 enum RTLD_LAZY = 0x00001;
215 enum RTLD_NOW = 0x00002;
216 enum RTLD_NOLOAD = 0x10;
217 enum RTLD_NODELETE = 0x80;
218 enum RTLD_GLOBAL = 0x00100;
219 enum RTLD_LOCAL = 0x00000;
220 enum RTLD_FIRST = 0x100;
224 void* dlopen(const scope char*, int);
225 void* dlsym(void*, const scope char*);
226 int dladdr(scope const void* addr, Dl_info* info);
230 const(char)* dli_fname;
232 const(char)* dli_sname;
236 else version (FreeBSD)
240 enum RTLD_MODEMASK = 0x3;
241 enum RTLD_GLOBAL = 0x100;
243 enum RTLD_TRACE = 0x200;
244 enum RTLD_NODELETE = 0x01000;
245 enum RTLD_NOLOAD = 0x02000;
249 void* dlopen(const scope char*, int);
250 void* dlsym(void*, const scope char*);
251 int dladdr(const(void)* addr, Dl_info* info);
255 const(char)* dli_fname;
257 const(char)* dli_sname;
261 else version (NetBSD)
265 enum RTLD_GLOBAL = 0x100;
266 enum RTLD_LOCAL = 0x200;
267 enum RTLD_NODELETE = 0x01000; /* Do not remove members. */
268 enum RTLD_NOLOAD = 0x02000;
272 void* dlopen(const scope char*, int);
273 void* dlsym(void*, const scope char*);
274 int dladdr(const(void)* addr, Dl_info* info);
278 const(char)* dli_fname;
280 const(char)* dli_sname;
284 else version (OpenBSD)
288 enum RTLD_GLOBAL = 0x100;
290 enum RTLD_TRACE = 0x200;
291 enum RTLD_NODELETE = 0x400;
295 void* dlopen(const scope char*, int);
296 void* dlsym(void*, const scope char*);
297 int dladdr(const(void)* addr, Dl_info* info);
301 const(char)* dli_fname;
303 const(char)* dli_sname;
307 else version (DragonFlyBSD)
311 enum RTLD_MODEMASK = 0x3;
312 enum RTLD_GLOBAL = 0x100;
314 enum RTLD_TRACE = 0x200;
315 enum RTLD_NODELETE = 0x01000;
316 enum RTLD_NOLOAD = 0x02000;
320 void* dlopen(const scope char*, int);
321 void* dlsym(void*, const scope char*);
322 int dladdr(const(void)* addr, Dl_info* info);
326 const(char)* dli_fname;
328 const(char)* dli_sname;
332 else version (Solaris)
336 enum RTLD_NOLOAD = 0x00004;
337 enum RTLD_DEEPBIND = 0x00008;
338 enum RTLD_GLOBAL = 0x100;
340 enum RTLD_PARENT = 0x00200;
341 enum RTLD_GROUP = 0x00400;
342 enum RTLD_WORLD = 0x00800;
343 enum RTLD_NODELETE = 0x01000;
344 enum RTLD_FIRST = 0x02000;
345 enum RTLD_CONFGEN = 0x10000;
349 void* dlopen(const scope char*, int);
350 void* dlsym(void*, const scope char*);
351 int dladdr(const(void)* addr, Dl_info* info);
355 const(char)* dli_fname;
357 const(char)* dli_sname;
361 else version (CRuntime_Bionic)
371 int dladdr(const scope void*, Dl_info*);
373 const(char)* dlerror();
374 void* dlopen(const scope char*, int);
375 void* dlsym(void*, const scope char*);
379 const(char)* dli_fname;
381 const(char)* dli_sname;
385 else version (CRuntime_Musl)
391 RTLD_NODELETE = 4096,
396 const(char)* dlerror();
397 void* dlopen(const scope char*, int);
398 void* dlsym(void*, const scope char*);
400 int dladdr(scope const void *addr, Dl_info *info);
403 const(char)* dli_fname;
405 const(char)* dli_sname;
409 else version (CRuntime_UClibc)
413 enum RTLD_LAZY = 0x0001;
414 enum RTLD_NOW = 0x0002;
415 enum RTLD_BINDING_MASK = 0x3;
416 enum RTLD_NOLOAD = 0x00004;
417 enum RTLD_GLOBAL = 0x00100;
419 enum RTLD_NODELETE = 0x01000;
421 else version (MIPS_Any)
423 enum RTLD_LAZY = 0x0001;
424 enum RTLD_NOW = 0x0002;
425 enum RTLD_BINDING_MASK = 0x3;
426 enum RTLD_NOLOAD = 0x00008;
427 enum RTLD_GLOBAL = 0x0004;
429 enum RTLD_NODELETE = 0x01000;
433 enum RTLD_LAZY = 0x0001;
434 enum RTLD_NOW = 0x0002;
435 enum RTLD_BINDING_MASK = 0x3;
436 enum RTLD_NOLOAD = 0x00004;
437 enum RTLD_GLOBAL = 0x00100;
439 enum RTLD_NODELETE = 0x01000;
442 static assert(0, "unimplemented");
446 void* dlopen(const scope char*, int);
447 void* dlsym(void*, const scope char*);
448 int dladdr(const scope void*, Dl_info*);
452 const(char)* dli_fname;
454 const(char)* dli_sname;