Mercurial > hg > xemacs-beta
comparison src/sysdll.c @ 267:966663fcf606 r20-5b32
Import from CVS: tag r20-5b32
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:26:29 +0200 |
parents | 8efd647ea9ca |
children | c5d627a313b1 |
comparison
equal
deleted
inserted
replaced
266:18d185df8c54 | 267:966663fcf606 |
---|---|
91 int dll_init(CONST char *arg) { | 91 int dll_init(CONST char *arg) { |
92 return(0); | 92 return(0); |
93 } | 93 } |
94 | 94 |
95 dll_handle dll_open(CONST char *fname) { | 95 dll_handle dll_open(CONST char *fname) { |
96 return((dll_handle)shl_load(fname,BIND_DEFERRED,0L)); | 96 shl_t h = shl_load(fname,BIND_DEFERRED,0L); |
97 } | 97 shl_t *hp = NULL; |
98 | 98 |
99 int dll_close(dll_handle h) { | 99 if (h) { |
100 return (shl_unload((shl_t)h)); | 100 hp = (shl_t *)malloc(sizeof(shl_t)); |
101 if (!hp) { | |
102 shl_unload(h); | |
103 } else { | |
104 *hp = h; | |
105 } | |
106 } | |
107 return((dll_handle)hp); | |
108 } | |
109 | |
110 int dll_close(dll_handle h) { | |
111 shl_t h = *((shl_t *)hp); | |
112 free(hp); | |
113 return (shl_unload(h)); | |
101 } | 114 } |
102 | 115 |
103 dll_func dll_function(dll_handle h,CONST char *n) { | 116 dll_func dll_function(dll_handle h,CONST char *n) { |
104 long handle = 0L; | 117 long handle = 0L; |
105 | 118 |
106 if (shl_findsym(&(shl_t)h,n,TYPE_PROCEDURE,&handle)) | 119 if (shl_findsym((shl_t *)h,n,TYPE_PROCEDURE,&handle)) |
107 return(NULL); | 120 return(NULL); |
108 | 121 |
109 return((dll_func)handle); | 122 return((dll_func)handle); |
110 } | 123 } |
111 | 124 |
112 dll_var dll_variable(dll_handle h,CONST char *n) { | 125 dll_var dll_variable(dll_handle h,CONST char *n) { |
113 long handle = 0L; | 126 long handle = 0L; |
114 | 127 |
115 if (shl_findsym(&(shl_t)h,n,TYPE_DATA,&handle)) | 128 if (shl_findsym((shl_t *)h,n,TYPE_DATA,&handle)) |
116 return(NULL); | 129 return(NULL); |
117 | 130 |
118 return((dll_var)handle); | 131 return((dll_var)handle); |
119 } | 132 } |
120 | 133 |