|
1 | | -/*------------------------------------------------------------------------- |
| 1 | +/* Dummy file used for nothing at this point |
2 | 2 | * |
3 | | - * dynloader.c-- |
4 | | - * Dynamic Loader for Postgres for DG/UX, generated from those for |
5 | | - * Linux. |
| 3 | + * see dgux.h |
6 | 4 | * |
7 | | - * Copyright (c) 1994, Regents of the University of California |
8 | | - * |
9 | | - * |
10 | | - * IDENTIFICATION |
11 | | - * $Header: /cvsroot/pgsql/src/backend/port/dynloader/dgux.c,v 1.1 1997/12/20 04:48:02 scrappy Exp $ |
12 | | - * |
13 | | - *------------------------------------------------------------------------- |
| 5 | + * $Id: dgux.c,v 1.2 1998/02/14 19:56:19 scrappy Exp $ |
14 | 6 | */ |
15 | | -#include <stdio.h> |
16 | | -#include <dld.h> |
17 | | -#include "postgres.h" |
18 | | -#include "port-protos.h" |
19 | | -#include "utils/elog.h" |
20 | | -#include "fmgr.h" |
21 | | - |
22 | | -extern char pg_pathname[]; |
23 | | - |
24 | | -void * |
25 | | -pg_dlopen(char *filename) |
26 | | -{ |
27 | | - static int dl_initialized = 0; |
28 | | - |
29 | | - /* |
30 | | - * initializes the dynamic loader with the executable's pathname. |
31 | | - * (only needs to do this the first time pg_dlopen is called.) |
32 | | - */ |
33 | | - if (!dl_initialized) |
34 | | - { |
35 | | - if (dld_init(dld_find_executable(pg_pathname))) |
36 | | - { |
37 | | - return NULL; |
38 | | - } |
39 | | - |
40 | | - /* |
41 | | - * if there are undefined symbols, we want dl to search from the |
42 | | - * following libraries also. |
43 | | - */ |
44 | | - dl_initialized = 1; |
45 | | - } |
46 | | - |
47 | | - /* |
48 | | - * link the file, then check for undefined symbols! |
49 | | - */ |
50 | | - if (dld_link(filename)) |
51 | | - { |
52 | | - return NULL; |
53 | | - } |
54 | | - |
55 | | - /* |
56 | | - * If undefined symbols: try to link with the C and math libraries! |
57 | | - * This could be smarter, if the dynamic linker was able to handle |
58 | | - * shared libs! |
59 | | - */ |
60 | | - if (dld_undefined_sym_count > 0) |
61 | | - { |
62 | | - if (dld_link("/usr/lib/libc.a")) |
63 | | - { |
64 | | - elog(NOTICE, "dld: Cannot link C library!"); |
65 | | - return NULL; |
66 | | - } |
67 | | - if (dld_undefined_sym_count > 0) |
68 | | - { |
69 | | - if (dld_link("/usr/lib/libm.a")) |
70 | | - { |
71 | | - elog(NOTICE, "dld: Cannot link math library!"); |
72 | | - return NULL; |
73 | | - } |
74 | | - if (dld_undefined_sym_count > 0) |
75 | | - { |
76 | | - int count = dld_undefined_sym_count; |
77 | | - char **list = dld_list_undefined_sym(); |
78 | | - |
79 | | - /* list the undefined symbols, if any */ |
80 | | - elog(NOTICE, "dld: Undefined:"); |
81 | | - do |
82 | | - { |
83 | | - elog(NOTICE, " %s", *list); |
84 | | - list++; |
85 | | - count--; |
86 | | - } while (count > 0); |
87 | | - |
88 | | - dld_unlink_by_file(filename, 1); |
89 | | - return NULL; |
90 | | - } |
91 | | - } |
92 | | - } |
93 | | - |
94 | | - return (void *) strdup(filename); |
95 | | -} |
96 | 7 |
|
97 | | -char * |
98 | | -pg_dlerror() |
99 | | -{ |
100 | | - return dld_strerror(dld_errno); |
101 | | -} |
0 commit comments