1
/*-------------------------------------------------------------------------
4
* Dynamic Loader for Postgres for Linux, generated from those for
7
* You need to install the dld library on your Linux system!
9
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
10
* Portions Copyright (c) 1994, Regents of the University of California
14
* $PostgreSQL: pgsql/src/backend/port/dynloader/linux.c,v 1.30 2004-12-31 22:00:32 pgsql Exp $
16
*-------------------------------------------------------------------------
25
#include "dynloader.h"
26
#include "miscadmin.h"
32
pg_dlopen(char *filename)
35
elog(ERROR, "dynamic load not supported");
38
static int dl_initialized = 0;
41
* initializes the dynamic loader with the executable's pathname.
42
* (only needs to do this the first time pg_dlopen is called.)
46
if (dld_init(dld_find_executable(my_exec_path)))
50
* if there are undefined symbols, we want dl to search from the
51
* following libraries also.
57
* link the file, then check for undefined symbols!
59
if (dld_link(filename))
63
* If undefined symbols: try to link with the C and math libraries!
64
* This could be smarter, if the dynamic linker was able to handle
67
if (dld_undefined_sym_count > 0)
69
if (dld_link("/usr/lib/libc.a"))
71
elog(WARNING, "could not link C library");
74
if (dld_undefined_sym_count > 0)
76
if (dld_link("/usr/lib/libm.a"))
78
elog(WARNING, "could not link math library");
81
if (dld_undefined_sym_count > 0)
83
int count = dld_undefined_sym_count;
84
char **list = dld_list_undefined_sym();
86
/* list the undefined symbols, if any */
89
elog(WARNING, "\"%s\" is undefined", *list);
94
dld_unlink_by_file(filename, 1);
100
return (void *) strdup(filename);
105
pg_dlsym(void *handle, char *funcname)
110
return (PGFunction) dld_get_func((funcname));
115
pg_dlclose(void *handle)
119
dld_unlink_by_file(handle, 1);
128
return "dynaloader unspported";
130
return dld_strerror(dld_errno);
134
#endif /* !HAVE_DLOPEN */