Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / backend / port / dynloader / bsdi.h
blob99bd341495d93e23fa51fe3d678465b311904b27
1 /*-------------------------------------------------------------------------
3 * bsdi.h
4 * Dynamic loader interface for BSD/OS
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * $PostgreSQL$
11 *-------------------------------------------------------------------------
13 #ifndef PORT_PROTOS_H
14 #define PORT_PROTOS_H
16 #include "utils/dynamic_loader.h"
19 #ifdef HAVE_DLOPEN
21 #include <dlfcn.h>
24 * In some older systems, the RTLD_NOW flag isn't defined and the mode
25 * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
26 * if available, but it doesn't exist everywhere.
27 * If it doesn't exist, set it to 0 so it has no effect.
29 #ifndef RTLD_NOW
30 #define RTLD_NOW 1
31 #endif
32 #ifndef RTLD_GLOBAL
33 #define RTLD_GLOBAL 0
34 #endif
36 #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
37 #define pg_dlsym dlsym
38 #define pg_dlclose dlclose
39 #define pg_dlerror dlerror
40 #else /* not HAVE_DLOPEN */
42 #define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname)))
43 #define pg_dlclose(handle) \
44 do { \
45 dld_unlink_by_file(handle, 1); \
46 free(handle); \
47 } while (0)
48 #endif /* not HAVE_DLOPEN */
50 #endif /* PORT_PROTOS_H */