diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2020-12-11 14:32:52 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2021-01-17 12:51:39 +0100 |
commit | 0ea2334d46ca84c1a27bd086700f620a06401f94 (patch) | |
tree | 89e768d6c77492dee9cf6b520d562b8e35a7cee5 /src/dlfcn.h | |
parent | 06ffb62a31f8986d1cda864bb8c3a8967d5a65fa (diff) | |
download | dlfcn-win32-0ea2334d46ca84c1a27bd086700f620a06401f94.tar.gz dlfcn-win32-0ea2334d46ca84c1a27bd086700f620a06401f94.tar.bz2 dlfcn-win32-0ea2334d46ca84c1a27bd086700f620a06401f94.zip |
Add function dladdr() and associated test application test-dladdr
Diffstat (limited to 'src/dlfcn.h')
-rw-r--r-- | src/dlfcn.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/dlfcn.h b/src/dlfcn.h index 9ddbba3..164216f 100644 --- a/src/dlfcn.h +++ b/src/dlfcn.h | |||
@@ -28,9 +28,13 @@ | |||
28 | extern "C" { | 28 | extern "C" { |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #if defined(DLFCN_WIN32_SHARED) | ||
31 | #if defined(DLFCN_WIN32_EXPORTS) | 32 | #if defined(DLFCN_WIN32_EXPORTS) |
32 | # define DLFCN_EXPORT __declspec(dllexport) | 33 | # define DLFCN_EXPORT __declspec(dllexport) |
33 | #else | 34 | #else |
35 | # define DLFCN_EXPORT __declspec(dllimport) | ||
36 | #endif | ||
37 | #else | ||
34 | # define DLFCN_EXPORT | 38 | # define DLFCN_EXPORT |
35 | #endif | 39 | #endif |
36 | 40 | ||
@@ -59,6 +63,15 @@ extern "C" { | |||
59 | /* Specifies the next object after this one that defines name. */ | 63 | /* Specifies the next object after this one that defines name. */ |
60 | #define RTLD_NEXT ((void *)-1) | 64 | #define RTLD_NEXT ((void *)-1) |
61 | 65 | ||
66 | /* Structure filled in by dladdr() */ | ||
67 | typedef struct dl_info | ||
68 | { | ||
69 | const char *dli_fname; /* Filename of defining object (thread unsafe and reused on every call to dladdr) */ | ||
70 | void *dli_fbase; /* Load address of that object */ | ||
71 | const char *dli_sname; /* Name of nearest lower symbol */ | ||
72 | void *dli_saddr; /* Exact value of nearest symbol */ | ||
73 | } Dl_info; | ||
74 | |||
62 | /* Open a symbol table handle. */ | 75 | /* Open a symbol table handle. */ |
63 | DLFCN_EXPORT void *dlopen(const char *file, int mode); | 76 | DLFCN_EXPORT void *dlopen(const char *file, int mode); |
64 | 77 | ||
@@ -71,6 +84,9 @@ DLFCN_EXPORT void *dlsym(void *handle, const char *name); | |||
71 | /* Get diagnostic information. */ | 84 | /* Get diagnostic information. */ |
72 | DLFCN_EXPORT char *dlerror(void); | 85 | DLFCN_EXPORT char *dlerror(void); |
73 | 86 | ||
87 | /* Translate address to symbolic information (no POSIX standard) */ | ||
88 | DLFCN_EXPORT int dladdr(void *addr, Dl_info *info); | ||
89 | |||
74 | #ifdef __cplusplus | 90 | #ifdef __cplusplus |
75 | } | 91 | } |
76 | #endif | 92 | #endif |