113 |
struct ascend_dlrecord *nextptr, *lastptr, *old; |
struct ascend_dlrecord *nextptr, *lastptr, *old; |
114 |
void *dlreturn = NULL; |
void *dlreturn = NULL; |
115 |
|
|
116 |
if ((g_ascend_dllist==NULL) || (NULL == path)) return NULL; |
if ((g_ascend_dllist == NULL) || (NULL == path)) return NULL; |
117 |
|
|
118 |
if (strcmp(path,g_ascend_dllist->path)==0) { |
if (strcmp(path,g_ascend_dllist->path)==0) { |
119 |
/* head case */ |
/* head case */ |
173 |
{ |
{ |
174 |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
175 |
HINSTANCE xlib; |
HINSTANCE xlib; |
176 |
int (*install)(); |
int (*install)() = NULL; |
177 |
|
|
178 |
if (NULL == path) { |
if (NULL == path) { |
179 |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
202 |
if (0 != AscAddRecord(xlib,path)) { |
if (0 != AscAddRecord(xlib,path)) { |
203 |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
204 |
} |
} |
205 |
return (initFun == NULL) ? 0 : (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
206 |
} |
} |
207 |
#endif /* __WIN32__ */ |
#endif /* __WIN32__ */ |
208 |
|
|
209 |
#if defined(sun) || defined(linux) |
#if defined(sun) || defined(linux) |
210 |
#ifndef MACH |
#ifndef MACH |
211 |
#include <dlfcn.h> |
#include <dlfcn.h> |
214 |
{ |
{ |
215 |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
216 |
void *xlib; |
void *xlib; |
217 |
int (*install)(); |
int (*install)() = NULL; |
218 |
|
|
219 |
if (NULL == path) { |
if (NULL == path) { |
220 |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
227 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
228 |
*/ |
*/ |
229 |
xlib = dlopen(path, 1); |
xlib = dlopen(path, 1); |
230 |
install = (int (*)())dlsym(xlib, initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
231 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
232 |
return 1; |
return 1; |
233 |
} |
} |
234 |
|
if (NULL != initFun) { |
235 |
|
install = (int (*)())dlsym(xlib, initFun); |
236 |
|
if (install == NULL) { |
237 |
|
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
238 |
|
dlclose(xlib); |
239 |
|
return 1; |
240 |
|
} |
241 |
|
} |
242 |
if (0 != AscAddRecord(xlib,path)) { |
if (0 != AscAddRecord(xlib,path)) { |
243 |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
244 |
} |
} |
245 |
return (initFun == NULL) ? 0 : (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
246 |
} |
} |
247 |
|
|
248 |
int DynamicLoad(CONST char *path, CONST char *initFun) |
int DynamicLoad(CONST char *path, CONST char *initFun) |
249 |
{ |
{ |
250 |
void *xlib; |
void *xlib; |
251 |
int (*install)(); |
int (*install)() = NULL; |
252 |
|
|
253 |
if (NULL == path) { |
if (NULL == path) { |
254 |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
260 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
261 |
*/ |
*/ |
262 |
xlib = dlopen(path, 1); |
xlib = dlopen(path, 1); |
263 |
install = (int (*)())dlsym(xlib, initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
264 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
265 |
return 1; |
return 1; |
266 |
} |
} |
267 |
/* |
if (NULL != initFun) { |
268 |
* Try to install the extension and report success or failure |
install = (int (*)())dlsym(xlib, initFun); |
269 |
*/ |
if (install == NULL) { |
270 |
return (*install)(); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
271 |
|
dlclose(xlib); |
272 |
|
return 1; |
273 |
|
} |
274 |
|
} |
275 |
|
/* Try to install the extension and report success or failure */ |
276 |
|
return (install == NULL) ? 0 : (*install)(); |
277 |
} |
} |
278 |
#else /* MACH */ |
#else /* MACH */ |
279 |
int DynamicLoad(CONST char *path, CONST char *initFun) |
int DynamicLoad(CONST char *path, CONST char *initFun) |
284 |
#endif /* sun */ |
#endif /* sun */ |
285 |
|
|
286 |
|
|
|
|
|
287 |
#ifdef __osf__ |
#ifdef __osf__ |
288 |
#include <dlfcn.h> |
#include <dlfcn.h> |
289 |
int Asc_DynamicLoad(CONST char *path, CONST char *initFun) |
int Asc_DynamicLoad(CONST char *path, CONST char *initFun) |
290 |
{ |
{ |
291 |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
292 |
void *xlib; |
void *xlib; |
293 |
int (*install)(); |
int (*install)() = NULL; |
294 |
|
|
295 |
if (NULL == path) { |
if (NULL == path) { |
296 |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
304 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
305 |
*/ |
*/ |
306 |
xlib = dlopen((char *)path, 1); |
xlib = dlopen((char *)path, 1); |
307 |
install = (int (*)())dlsym(xlib,(char *)initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
308 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
309 |
return 1; |
return 1; |
310 |
} |
} |
311 |
|
if (NULL != initFun) { |
312 |
|
install = (int (*)())dlsym(xlib,(char *)initFun); |
313 |
|
if (install==NULL) { |
314 |
|
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
315 |
|
dlclose(xlib); |
316 |
|
return 1; |
317 |
|
} |
318 |
|
} |
319 |
if (0 != AscAddRecord(xlib,path)) { |
if (0 != AscAddRecord(xlib,path)) { |
320 |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
321 |
} |
} |
322 |
return (initFun == NULL) ? 0 : (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
323 |
} |
} |
324 |
int DynamicLoad(CONST char *path, CONST char *initFun) |
int DynamicLoad(CONST char *path, CONST char *initFun) |
325 |
{ |
{ |
326 |
void *xlib; |
void *xlib; |
327 |
int (*install)(); |
int (*install)() = NULL; |
328 |
|
|
329 |
if (NULL == path) { |
if (NULL == path) { |
330 |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
336 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
337 |
*/ |
*/ |
338 |
xlib = dlopen((char *)path, 1); |
xlib = dlopen((char *)path, 1); |
339 |
install = (int (*)())dlsym(xlib,(char *)initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
340 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
341 |
return 1; |
return 1; |
342 |
} |
} |
343 |
/* |
if (NULL != initFun) { |
344 |
* Try to install the extension and report success or failure |
install = (int (*)())dlsym(xlib,(char *)initFun); |
345 |
*/ |
if (install==NULL) { |
346 |
return (*install)(); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
347 |
|
dlclose(xlib); |
348 |
|
return 1; |
349 |
|
} |
350 |
|
} |
351 |
|
/* Try to install the extension and report success or failure */ |
352 |
|
return (install == NULL) ? 0 : (*install)(); |
353 |
} |
} |
354 |
#endif /* osf */ |
#endif /* osf */ |
355 |
|
|
982 |
{ |
{ |
983 |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
984 |
void *xlib; |
void *xlib; |
985 |
int (*install)(); |
int (*install)() = NULL; |
986 |
|
|
987 |
if (NULL == path) { |
if (NULL == path) { |
988 |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
996 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
997 |
*/ |
*/ |
998 |
xlib = dlopen(path, 1); |
xlib = dlopen(path, 1); |
999 |
install = (int (*)())dlsym(xlib, initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
1000 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
1001 |
return 1; |
return 1; |
1002 |
} |
} |
1003 |
|
if (NULL != initFun) { |
1004 |
|
install = (int (*)())dlsym(xlib, initFun); |
1005 |
|
if (install == NULL) { |
1006 |
|
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
1007 |
|
dlclose(xlib); |
1008 |
|
return 1; |
1009 |
|
} |
1010 |
|
} |
1011 |
|
|
1012 |
if (0 != AscAddRecord(xlib,path)) { |
if (0 != AscAddRecord(xlib,path)) { |
1013 |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
1014 |
} |
} |
1015 |
return (initFun == NULL) ? 0 : (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
1016 |
} |
} |
1017 |
|
|
1018 |
int DynamicLoad(CONST char *path, CONST char *initFun) |
int DynamicLoad(CONST char *path, CONST char *initFun) |
1019 |
{ |
{ |
1020 |
void *xlib; |
void *xlib; |
1021 |
int (*install)(); |
int (*install)() = NULL; |
1022 |
|
|
1023 |
if (NULL == path) { |
if (NULL == path) { |
1024 |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
1030 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
1031 |
*/ |
*/ |
1032 |
xlib = dlopen(path, 1); |
xlib = dlopen(path, 1); |
1033 |
install = (int (*)())dlsym(xlib, initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
1034 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
1035 |
return 1; |
return 1; |
1036 |
} |
} |
1037 |
/* |
if (NULL != initFun) { |
1038 |
* Try to install the extension and report success or failure |
install = (int (*)())dlsym(xlib, initFun); |
1039 |
*/ |
if (install == NULL) { |
1040 |
return (*install)(); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
1041 |
|
dlclose(xlib); |
1042 |
|
return 1; |
1043 |
|
} |
1044 |
|
} |
1045 |
|
|
1046 |
|
/* Try to install the extension and report success or failure */ |
1047 |
|
return (install == NULL) ? 0 : (*install)(); |
1048 |
} |
} |
1049 |
#endif /* solaris, aix */ |
#endif /* solaris, aix */ |
1050 |
|
|
1051 |
|
|
1052 |
#ifdef _SGI_SOURCE |
#ifdef _SGI_SOURCE |
1053 |
#include <dlfcn.h> |
#include <dlfcn.h> |
1054 |
int Asc_DynamicLoad(CONST char *path, CONST char *initFun) |
int Asc_DynamicLoad(CONST char *path, CONST char *initFun) |
1055 |
{ |
{ |
1056 |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
1057 |
void *xlib; |
void *xlib; |
1058 |
int (*install)(); |
int (*install)() = NULL; |
1059 |
|
|
1060 |
if (NULL == path) { |
if (NULL == path) { |
1061 |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
1069 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
1070 |
*/ |
*/ |
1071 |
xlib = dlopen(path, 1); |
xlib = dlopen(path, 1); |
1072 |
install = (int (*)())dlsym(xlib, initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
1073 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
1074 |
return 1; |
return 1; |
1075 |
} |
} |
1076 |
|
if (NULL != initFun) { |
1077 |
|
install = (int (*)())dlsym(xlib, initFun); |
1078 |
|
if (install == NULL) { |
1079 |
|
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
1080 |
|
dlclose(xlib); |
1081 |
|
return 1; |
1082 |
|
} |
1083 |
|
} |
1084 |
|
|
1085 |
if (0 != AscAddRecord(xlib,path)) { |
if (0 != AscAddRecord(xlib,path)) { |
1086 |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
1087 |
} |
} |
1088 |
return (initFun == NULL) ? 0 : (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
1089 |
} |
} |
1090 |
|
|
1091 |
int DynamicLoad(CONST char *path, CONST char *initFun) |
int DynamicLoad(CONST char *path, CONST char *initFun) |
1092 |
{ |
{ |
1093 |
void *xlib; |
void *xlib; |
1094 |
int (*install)(); |
int (*install)() = NULL; |
1095 |
|
|
1096 |
if (NULL == path) { |
if (NULL == path) { |
1097 |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
1103 |
* it does not define the named install proc, report an error |
* it does not define the named install proc, report an error |
1104 |
*/ |
*/ |
1105 |
xlib = dlopen(path, 1); |
xlib = dlopen(path, 1); |
1106 |
install = (int (*)())dlsym(xlib, initFun); |
if (xlib == NULL) { |
|
if ((xlib == NULL) || (install==NULL)) { |
|
1107 |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
|
if ( xlib != NULL ) dlclose(xlib); |
|
1108 |
return 1; |
return 1; |
1109 |
} |
} |
1110 |
/* |
if (NULL != initFun) { |
1111 |
* Try to install the extension and report success or failure |
install = (int (*)())dlsym(xlib, initFun); |
1112 |
*/ |
if (install == NULL) { |
1113 |
return (*install)(); |
FPRINTF(stderr,"%s\n",(char *)dlerror()); |
1114 |
|
dlclose(xlib); |
1115 |
|
return 1; |
1116 |
|
} |
1117 |
|
} |
1118 |
|
/* Try to install the extension and report success or failure */ |
1119 |
|
return (install == NULL) ? 0 : (*install)(); |
1120 |
} |
} |
1121 |
#endif /* _SGI_SOURCE */ |
#endif /* _SGI_SOURCE */ |
1122 |
|
|
1123 |
|
|
1124 |
#ifdef __hpux |
#ifdef __hpux |
1125 |
/* |
/* |
1126 |
* Modified to work with HP/UX 9.X Operating System. |
* Modified to work with HP/UX 9.X Operating System. |
1137 |
{ |
{ |
1138 |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
1139 |
shl_t xlib; |
shl_t xlib; |
1140 |
int (*install)(); |
int (*install)() = NULL; |
1141 |
int i; |
int i; |
1142 |
|
|
1143 |
if (NULL == path) { |
if (NULL == path) { |
1174 |
if (0 != AscAddRecord(xlib,path)) { |
if (0 != AscAddRecord(xlib,path)) { |
1175 |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
1176 |
} |
} |
1177 |
return (initFun == NULL) ? 0 : (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
1178 |
} |
} |
1179 |
|
|
1180 |
int DynamicLoad(CONST char *path, CONST char *initFun) |
int DynamicLoad(CONST char *path, CONST char *initFun) |
1181 |
{ |
{ |
1182 |
shl_t xlib; |
shl_t xlib; |
1183 |
int (*install)(); |
int (*install)() = NULL; |
1184 |
int i; |
int i; |
1185 |
|
|
1186 |
if (NULL == path) { |
if (NULL == path) { |
1211 |
/* |
/* |
1212 |
* Try to install the extension and report success or failure |
* Try to install the extension and report success or failure |
1213 |
*/ |
*/ |
1214 |
return (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
1215 |
} |
} |
1216 |
#endif /* __hpux */ |
#endif /* __hpux */ |
1217 |
|
|
1218 |
|
|
1219 |
|
|
1220 |
#ifdef ultrix |
#ifdef ultrix |
1221 |
/* |
/* |
1222 |
* Ultrix 4.x Dynamic Loader Library Version 1.0 |
* Ultrix 4.x Dynamic Loader Library Version 1.0 |
1324 |
{ |
{ |
1325 |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
#define ASCDL_OK /* this line should appear inside each Asc_DynamicLoad */ |
1326 |
void *xlib; |
void *xlib; |
1327 |
int (*install)(); |
int (*install)() = NULL; |
1328 |
|
|
1329 |
if (NULL == path) { |
if (NULL == path) { |
1330 |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"Asc_DynamicLoad failed: Null path\n"); |
1346 |
if (0 != AscAddRecord(xlib,path)) { |
if (0 != AscAddRecord(xlib,path)) { |
1347 |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
FPRINTF(stderr,"Asc_DynamicLoad failed to record library (%s)\n",path); |
1348 |
} |
} |
1349 |
return (initFun == NULL) ? 0 : (*install)(); |
return (install == NULL) ? 0 : (*install)(); |
1350 |
} |
} |
1351 |
/* |
/* |
1352 |
* This is where we put a wrapper around all of the |
* This is where we put a wrapper around all of the |
1355 |
int DynamicLoad(CONST char *path, CONST char *initFun) |
int DynamicLoad(CONST char *path, CONST char *initFun) |
1356 |
{ |
{ |
1357 |
void *xlib; |
void *xlib; |
1358 |
int (*install)(); |
int (*install)() = NULL; |
1359 |
|
|
1360 |
if (NULL == path) { |
if (NULL == path) { |
1361 |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
FPRINTF(stderr,"DynamicLoad failed: Null path\n"); |
1373 |
if ( xlib != NULL ) dlclose(xlib); |
if ( xlib != NULL ) dlclose(xlib); |
1374 |
return 1; |
return 1; |
1375 |
} |
} |
1376 |
/* |
/* Try to install the extension and report success or failure */ |
1377 |
* Try to install the extension and report success or failure |
return (install == NULL) ? 0 : (*install)(); |
|
*/ |
|
|
return (*install)(); |
|
1378 |
} |
} |
1379 |
|
|
1380 |
|
|
2864 |
#define UNLOAD shl_unload |
#define UNLOAD shl_unload |
2865 |
#define DLL_CAST (shl_t) |
#define DLL_CAST (shl_t) |
2866 |
#define ASC_DLERRSTRING "NULL definition" |
#define ASC_DLERRSTRING "NULL definition" |
2867 |
|
#define UNLOAD_SUCCESS 0 |
2868 |
#endif /* __hpux */ |
#endif /* __hpux */ |
2869 |
#ifdef __WIN32__ |
#ifdef __WIN32__ |
2870 |
#define UNLOAD FreeLibrary |
#define UNLOAD FreeLibrary |
2871 |
#define DLLSYM GetProcAddress |
#define DLLSYM GetProcAddress |
2872 |
#define DLL_CAST (HINSTANCE) |
#define DLL_CAST (HINSTANCE) |
2873 |
#define ASC_DLERRSTRING "unknown" |
#define ASC_DLERRSTRING "unknown" |
2874 |
|
#define UNLOAD_SUCCESS TRUE |
2875 |
#endif /* __WIN32__ */ |
#endif /* __WIN32__ */ |
2876 |
#ifndef UNLOAD |
#ifndef UNLOAD |
2877 |
#define UNLOAD dlclose |
#define UNLOAD dlclose |
2878 |
#define DLLSYM dlsym |
#define DLLSYM dlsym |
2879 |
#define DLL_CAST (void *) |
#define DLL_CAST (void *) |
2880 |
#define ASC_DLERRSTRING dlerror() |
#define ASC_DLERRSTRING dlerror() |
2881 |
|
#define UNLOAD_SUCCESS 0 |
2882 |
#endif /* UNLOAD */ |
#endif /* UNLOAD */ |
2883 |
|
|
2884 |
int Asc_DynamicUnLoad(char *path) |
int Asc_DynamicUnLoad(char *path) |
2885 |
{ |
{ |
2886 |
void *dlreturn; |
void *dlreturn; |
2887 |
|
int retval; |
2888 |
|
|
2889 |
if (NULL == path) { |
if (NULL == path) { |
2890 |
FPRINTF(stderr, "Asc_DynamicUnLoad failed: Null path\n"); |
FPRINTF(stderr, "Asc_DynamicUnLoad failed: Null path\n"); |
2891 |
return -3; |
return -3; |
2897 |
return -3; |
return -3; |
2898 |
} |
} |
2899 |
FPRINTF(stderr, "Asc_DynamicUnLoad: forgetting & unloading %s \n", path); |
FPRINTF(stderr, "Asc_DynamicUnLoad: forgetting & unloading %s \n", path); |
2900 |
return UNLOAD(DLL_CAST dlreturn); |
/* |
2901 |
|
* dlclose() returns 0 on success, FreeLibrary() returns TRUE. |
2902 |
|
* A uniform convention is preferable, so trap and return 0 on success. |
2903 |
|
*/ |
2904 |
|
retval = UNLOAD(DLL_CAST dlreturn); |
2905 |
|
return (retval == UNLOAD_SUCCESS) ? 0 : retval; |
2906 |
} |
} |
2907 |
|
|
2908 |
/* |
/* |