annotate src/sysdll.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 966663fcf606
children 6330739388db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
1 /* sysdll.c --- system dependent support for dynamic linked libraries
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
2 Copyright (C) 1998 Free Software Foundation, Inc.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
3 Author: William Perry <wmperry@aventail.com>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
4
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
5 This file is part of XEmacs.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
6
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
10 later version.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
11
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
15 for more details.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
16
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to the Free
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
19 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
20 02111-1307, USA. */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
21
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
23 #include <config.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
24 #endif
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
25
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
26 #include <stdlib.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
27 #include <assert.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
28 #include <string.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
29 #include <stdio.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
30 #include "sysdll.h"
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
31
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
32 /* This whole file is conditional upon HAVE_DLL */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
33 #ifdef HAVE_SHLIB
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
34
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
35 /* Thankfully, most systems follow the ELFish dlopen() method.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
36 ** HAVE__DLOPEN is lame, but SCO has their dl* functions as _dl*, and
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
37 ** unless you include dlfcn.h you don't get the macros to mask them, and
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
38 ** autoconf fails to find them.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
39 **
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
40 ** Anybody who wants to use this on SCO needs to have their configure.in
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
41 ** look for _dlopen() as well as dlopen()
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
42 */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
43 #if defined(HAVE_DLOPEN) || defined(HAVE__DLOPEN)
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
44 #include <dlfcn.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
45
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
46 #ifndef RTLD_LAZY
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
47 #define RTLD_LAZY 1
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
48 #endif /* RTLD_LAZY isn't defined under FreeBSD - ick */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
49
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
50 #ifndef RTLD_GLOBAL
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
51 #define RTLD_GLOBAL 0
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
52 #endif
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
53
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
54 int dll_init(CONST char *arg) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
55 return(0);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
56 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
57
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
58 dll_handle dll_open(CONST char *fname) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
59 return((dll_handle)dlopen(fname,RTLD_LAZY|RTLD_GLOBAL));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
60 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
61
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
62 int dll_close(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
63 return(dlclose((void *)h));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
64 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
65
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
66 dll_func dll_function(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
67 #ifdef DLSYM_NEEDS_UNDERSCORE
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
68 char buf[1024];
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
69 *buf = '_';
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
70 (void)strcpy(buf + 1, n);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
71 n = buf;
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
72 #endif
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
73 return((dll_func)dlsym((void *)h,n));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
74 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
75
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
76 dll_var dll_variable(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
77 return((dll_var)dlsym((void *)h,n));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
78 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
79
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
80 CONST char *dll_error(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
81 #ifdef HAVE_DLERROR
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
82 return((CONST char *)dl_error());
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
83 #else
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
84 return("Shared library error");
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
85 #endif
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
86 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
87
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
88 #elif defined(HAVE_SHL_LOAD)
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
89 /* This is the HP/UX version */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
90 #include <dl.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
91 int dll_init(CONST char *arg) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
92 return(0);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
93 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
94
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
95 dll_handle dll_open(CONST char *fname) {
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
96 shl_t h = shl_load(fname,BIND_DEFERRED,0L);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
97 shl_t *hp = NULL;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
98
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
99 if (h) {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
100 hp = (shl_t *)malloc(sizeof(shl_t));
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
101 if (!hp) {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
102 shl_unload(h);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
103 } else {
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
104 *hp = h;
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
105 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
106 }
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
107 return((dll_handle)hp);
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
108 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
109
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
110 int dll_close(dll_handle h) {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
111 shl_t hp = *((shl_t *)h);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
112 free(hp);
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
113 return (shl_unload(h));
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
114 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
115
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
116 dll_func dll_function(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
117 long handle = 0L;
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
118
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
119 if (shl_findsym((shl_t *)h,n,TYPE_PROCEDURE,&handle))
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
120 return(NULL);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
121
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
122 return((dll_func)handle);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
123 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
124
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
125 dll_var dll_variable(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
126 long handle = 0L;
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
127
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 265
diff changeset
128 if (shl_findsym((shl_t *)h,n,TYPE_DATA,&handle))
265
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
129 return(NULL);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
130
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
131 return((dll_var)handle);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
132 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
133
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
134 CONST char *dll_error(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
135 return("Generic shared library error");
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
136 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
137
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
138 #elif defined(HAVE_INIT_DLD)
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
139 #include <dld.h>
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
140 int dll_init(CONST char *arg) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
141 char *real_exe = dld_find_executable(arg);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
142 int rc;
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
143
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
144 rc = dld_init(real_exe);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
145 if (rc) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
146 dld_perror (exe);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
147 return(-1);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
148 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
149 return(0);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
150 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
151
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
152 dll_handle dll_open(CONST char *fname) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
153 rc = dld_link(fname);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
154 if (rc) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
155 return (NULL);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
156 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
157 return((dll_handle)1);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
158 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
159
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
160 int dll_close(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
161 /* *sigh* DLD is pretty lame and doesn't return a handle that you can use
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
162 ** later on to free the file - you have to remember the filename and
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
163 ** use that as the unlinker. We should eventually keep a linked list
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
164 ** of loaded modules and then use the node pointer as the unique id
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
165 ** for the shared library. Wheeee. But not now.
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
166 */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
167 return(1);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
168 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
169
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
170 DLL_FUNC dll_function(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
171 return (dld_get_func(n));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
172 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
173
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
174 DLL_FUNC dll_variable(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
175 return (dld_get_symbol(n));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
176 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
177 #elif defined(_WINDOWS) || defined(WIN32)
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
178 int dll_init(CONST char *arg) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
179 return(0);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
180 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
181
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
182 dll_handle dll_open(CONST char *fname) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
183 return((dll_handle)LoadLibrary(fname));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
184 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
185
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
186 int dll_close(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
187 return(FreeLibrary(h));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
188 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
189
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
190 dll_func dll_function(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
191 return((dll_func)GetProcAddress(h,n));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
192 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
193
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
194 dll_func dll_variable(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
195 return((dll_func)GetProcAddress(h,n));
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
196 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
197
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
198 CONST char *dll_error(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
199 return("Windows DLL Error");
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
200 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
201 #else
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
202 /* Catchall if we don't know about this systems method of dynamic loading */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
203 int dll_init(CONST char *arg) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
204 return(-1);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
205 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
206
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
207 dll_handle dll_open(CONST char *fname) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
208 return(NULL);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
209 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
210
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
211 int dll_close(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
212 return(0);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
213 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
214
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
215 dll_func dll_function(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
216 return(NULL);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
217 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
218
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
219 dll_func dll_variable(dll_handle h,CONST char *n) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
220 return(NULL);
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
221 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
222
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
223 CONST char *dll_error(dll_handle h) {
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
224 return("Shared libraries not implemented on this system.");
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
225 }
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
226 #endif /* System conditionals */
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
227
8efd647ea9ca Import from CVS: tag r20-5b31
cvs
parents:
diff changeset
228 #endif /* HAVE_SHLIB */