1 /*-------------------------------------------------------------------------
4 * This dynamic loader uses Andrew Yu's libdl-1.0 package for Ultrix 4.x.
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
13 *-------------------------------------------------------------------------
18 #include "utils/dynamic_loader.h"
20 extern char my_exec_path
[];
23 pg_dlopen(char *filename
)
25 static int dl_initialized
= 0;
29 * initializes the dynamic loader with the executable's pathname. (only
30 * needs to do this the first time pg_dlopen is called.)
34 if (!dl_init(my_exec_path
))
38 * if there are undefined symbols, we want dl to search from the
39 * following libraries also.
41 dl_setLibraries("/usr/lib/libm_G0.a:/usr/lib/libc_G0.a");
46 * open the file. We do the symbol resolution right away so that we will
47 * know if there are undefined symbols. (This is in fact the same
48 * semantics as "ld -A". ie. you cannot have undefined symbols.
50 if ((handle
= dl_open(filename
, DL_NOW
)) == NULL
)
53 char **list
= dl_undefinedSymbols(&count
);
55 /* list the undefined symbols, if any */
60 elog(WARNING
, "\"%s\" is undefined", *list
);
66 return (void *) handle
;