for the module using the LIBPATH environment variable. It returns an
opaque handle to the module or NULL on error. The mode parameter can be
either RTLD_LAZY (for lazy function binding) or RTLD_NOW for immediate
-function binding. The AIX implementation currently does treat RTLD_NOW
-the same as RTLD_LAZY. The flag RTLD_GLOBAL might be or'ed into the
+function binding. The AIX implementation currently behaves as RTLD_NOW
+even if RTLD_LAZY is specified. The flag RTLD_GLOBAL might be or'ed into the
mode parameter to allow loaded modules to bind to global variables or
functions in other loaded modules loaded by dlopen(). If RTLD_GLOBAL is
not specified, only globals from the main part of the executable or
/*
- * $Id: aix.h,v 1.10 2001/11/08 20:37:52 momjian Exp $
+ * $Id: aix.h,v 1.11 2002/02/12 23:39:46 tgl Exp $
*
* @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52
* This is an unpublished work copyright (c) 1992 HELIOS Software GmbH
#include "utils/dynamic_loader.h"
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
/*-------------------------------------------------------------------------
*
- * Dynamic loader interface for BSD/OS
- *
+ * bsdi.h
+ * Dynamic loader interface for BSD/OS
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * port_protos.h,v 1.2 1995/05/25 22:51:03 andrew Exp
+ * $Id: bsdi.h,v 1.15 2002/02/12 23:39:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifdef HAVE_DLOPEN
#include <dlfcn.h>
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
dld_unlink_by_file(handle, 1); \
free(handle); \
} while (0)
+
#endif /* not HAVE_DLOPEN */
#endif /* PORT_PROTOS_H */
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: dgux.h,v 1.13 2001/11/05 17:46:27 momjian Exp $
+ * $Id: dgux.h,v 1.14 2002/02/12 23:40:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
*/
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
/*-------------------------------------------------------------------------
*
- * port_protos.h
- * port-specific prototypes for NetBSD 1.0
- *
+ * freebsd.h
+ * port-specific prototypes for FreeBSD
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: freebsd.h,v 1.14 2002/02/11 21:38:11 petere Exp $
+ * $Id: freebsd.h,v 1.15 2002/02/12 23:40:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/dynamic_loader.h"
-/* dynloader.c */
/*
* Dynamic Loader on NetBSD 1.0.
*
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
*/
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
-#define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+#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
/*-------------------------------------------------------------------------
*
- * port_protos.h
+ * irix5.h
* port-specific prototypes for Irix 5
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * port_protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
+ * $Id: irix5.h,v 1.12 2002/02/12 23:40:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
-/* dynloader.c */
/*
* Dynamic Loader on SunOS 4.
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
*/
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
/*-------------------------------------------------------------------------
*
- * Dynamic loader interface for Linux
+ * linux.h
+ * Port-specific prototypes for Linux
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: linux.h,v 1.16 2001/11/05 17:46:27 momjian Exp $
+ * $Id: linux.h,v 1.17 2002/02/12 23:40:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#else /* HAVE_DLOPEN */
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
/*-------------------------------------------------------------------------
*
- * port_protos.h
- * port-specific prototypes for NetBSD 1.0
+ * netbsd.h
+ * port-specific prototypes for NetBSD
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: netbsd.h,v 1.8 2001/11/05 17:46:27 momjian Exp $
+ * $Id: netbsd.h,v 1.9 2002/02/12 23:40:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/dynamic_loader.h"
-/* dynloader.c */
/*
* Dynamic Loader on NetBSD 1.0.
*
* begin with an underscore is fairly tricky, and some versions of
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
*/
-#define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#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
/*-------------------------------------------------------------------------
*
- * Dynamic loader for OpenBSD
+ * openbsd.h
+ * port-specific prototypes for OpenBSD
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: openbsd.h,v 1.9 2001/11/05 17:46:27 momjian Exp $
+ * $Id: openbsd.h,v 1.10 2002/02/12 23:40:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/dynamic_loader.h"
-/* dynloader.c */
/*
* Dynamic Loader on NetBSD 1.0.
*
* begin with an underscore is fairly tricky, and some versions of
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
*/
-#define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#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
/*-------------------------------------------------------------------------
*
- * alpha.h
+ * osf.h
* prototypes for OSF/1-specific routines
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: osf.h,v 1.7 2001/11/15 16:08:15 petere Exp $
+ * $Id: osf.h,v 1.8 2002/02/12 23:40:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
-/* dynloader.c */
-
/*
* Dynamic Loader on Alpha OSF/1.x
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
*/
-/* RTLD_GLOBAL is not available in <5.x */
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym(h, f) ((PGFunction) dlsym(h, f))
#define pg_dlclose(h) dlclose(h)
#define pg_dlerror() dlerror()
/*-------------------------------------------------------------------------
*
- * port_protos.h
+ * sco.h
* port-specific prototypes for SCO 3.2v5.2
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: sco.h,v 1.11 2001/11/05 17:46:27 momjian Exp $
+ * $Id: sco.h,v 1.12 2002/02/12 23:40:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
-/* dynloader.c */
/*
* Dynamic Loader on SCO 3.2v5.0.2
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
*/
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
-/* port.c */
-
#endif /* PORT_PROTOS_H */
-/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.7 2001/11/05 17:46:27 momjian Exp $ */
-
-#ifndef DYNLOADER_SOLARIS_H
-#define DYNLOADER_SOLARIS_H
+/*-------------------------------------------------------------------------
+ *
+ * solaris.h
+ * port-specific prototypes for Solaris
+ *
+ *
+ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: solaris.h,v 1.8 2002/02/12 23:40:53 tgl Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PORT_PROTOS_H
+#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
-#endif /* DYNLOADER_SOLARIS_H */
+#endif /* PORT_PROTOS_H */
/*-------------------------------------------------------------------------
*
- * port_protos.h
+ * sunos4.h
* port-specific prototypes for SunOS 4
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: sunos4.h,v 1.12 2001/12/05 02:03:59 ishii Exp $
+ * $Id: sunos4.h,v 1.13 2002/02/12 23:40:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
-/* dynloader.c */
/*
* Dynamic Loader on SunOS 4.
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
*/
-#define pg_dlopen(f) dlopen((f),1)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
/*-------------------------------------------------------------------------
*
- * dynloader.h
+ * svr4.h
* port-specific prototypes for Intel x86/Intel SVR4
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: svr4.h,v 1.11 2001/11/05 17:46:27 momjian Exp $
+ * $Id: svr4.h,v 1.12 2002/02/12 23:41:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
-#ifndef DYNLOADER_H
-#define DYNLOADER_H
+#ifndef PORT_PROTOS_H
+#define PORT_PROTOS_H
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
-/* dynloader.h */
/*
* Dynamic Loader on Intel x86/Intel SVR4.
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
*/
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
-#endif /* DYNLOADER_H */
+#endif /* PORT_PROTOS_H */
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
- /* dynloader.c */
/*
* Dynamic Loader on Intel x86/Intel SVR4.
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
- */
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+ */
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
- /* dynloader.c */
/*
* Dynamic Loader on Intel x86/Intel SVR4.
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
- */
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+ */
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
- /* dynloader.c */
/*
* Dynamic Loader on Intel x86/Windows NT
*
* this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded.
- *
- */
-#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
+ */
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror