#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
Go to the source code of this file.
Defines | |
#define | RTLD_NOW 1 |
#define | RTLD_GLOBAL 0 |
#define | pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL) |
#define | pg_dlsym BSD44_derived_dlsym |
#define | pg_dlclose BSD44_derived_dlclose |
#define | pg_dlerror BSD44_derived_dlerror |
Functions | |
char * | BSD44_derived_dlerror (void) |
void * | BSD44_derived_dlopen (const char *filename, int num) |
void * | BSD44_derived_dlsym (void *handle, const char *name) |
void | BSD44_derived_dlclose (void *handle) |
#define pg_dlopen | ( | f | ) | BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL) |
void BSD44_derived_dlclose | ( | void * | handle | ) |
char* BSD44_derived_dlerror | ( | void | ) |
Definition at line 48 of file freebsd.c.
References error_message, and NULL.
{ static char ret[BUFSIZ]; strcpy(ret, error_message); error_message[0] = 0; return (ret[0] == 0) ? NULL : ret; }
void* BSD44_derived_dlopen | ( | const char * | filename, | |
int | num | |||
) |
Definition at line 58 of file freebsd.c.
References dlerror(), dlopen(), error_message, NULL, and snprintf().
{ #if !defined(HAVE_DLOPEN) snprintf(error_message, sizeof(error_message), "dlopen (%s) not supported", file); return NULL; #else void *vp; if ((vp = dlopen((char *) file, num)) == NULL) snprintf(error_message, sizeof(error_message), "dlopen (%s) failed: %s", file, dlerror()); return vp; #endif }
void* BSD44_derived_dlsym | ( | void * | handle, | |
const char * | name | |||
) |
Definition at line 75 of file freebsd.c.
References buf, dlsym(), error_message, NULL, and snprintf().
{ #if !defined(HAVE_DLOPEN) snprintf(error_message, sizeof(error_message), "dlsym (%s) failed", name); return NULL; #else void *vp; #ifndef __ELF__ char buf[BUFSIZ]; if (*name != '_') { snprintf(buf, sizeof(buf), "_%s", name); name = buf; } #endif /* !__ELF__ */ if ((vp = dlsym(handle, (char *) name)) == NULL) snprintf(error_message, sizeof(error_message), "dlsym (%s) failed", name); return vp; #endif }