diff options
Diffstat (limited to 'src/os-unix.h')
-rw-r--r-- | src/os-unix.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/os-unix.h b/src/os-unix.h index ec9a940..a25d8ed 100644 --- a/src/os-unix.h +++ b/src/os-unix.h @@ -39,10 +39,19 @@ typedef char os_char; #define os_getenv getenv #define os_getcwd getcwd +#define OS_DLPREFIX "lib" #define OS_DLSUFFIX ".so" #define OS_MAIN main +static inline void *os_dlopen(const char *name) { + return dlopen(name, RTLD_NOW); +} +static inline void *os_dlhandle(const char *name) { + void *ret = dlopen(name, RTLD_NOW | RTLD_NOLOAD); + if (ret) dlclose(ret); + return ret; +} #define os_dlsym dlsym #ifdef __linux__ |