237 |
|
|
238 |
#ifdef DYNAMIC_LINKING |
#ifdef DYNAMIC_LINKING |
239 |
|
|
240 |
#include "libltdl/ltdl.h" |
#include "guile-ltdl.h" |
241 |
|
|
242 |
static void * |
static void * |
243 |
sysdep_dynl_link (const char *fname, const char *subr) |
sysdep_dynl_link (const char *fname, const char *subr) |
244 |
{ |
{ |
245 |
lt_dlhandle handle; |
scm_lt_dlhandle handle; |
246 |
handle = lt_dlopenext (fname); |
handle = scm_lt_dlopenext (fname); |
247 |
if (NULL == handle) |
if (NULL == handle) |
248 |
{ |
{ |
249 |
SCM fn; |
SCM fn; |
251 |
|
|
252 |
SCM_ALLOW_INTS; |
SCM_ALLOW_INTS; |
253 |
fn = scm_makfrom0str (fname); |
fn = scm_makfrom0str (fname); |
254 |
msg = scm_makfrom0str (lt_dlerror ()); |
msg = scm_makfrom0str (scm_lt_dlerror ()); |
255 |
scm_misc_error (subr, "file: ~S, message: ~S", scm_list_2 (fn, msg)); |
scm_misc_error (subr, "file: ~S, message: ~S", scm_list_2 (fn, msg)); |
256 |
} |
} |
257 |
return (void *) handle; |
return (void *) handle; |
260 |
static void |
static void |
261 |
sysdep_dynl_unlink (void *handle, const char *subr) |
sysdep_dynl_unlink (void *handle, const char *subr) |
262 |
{ |
{ |
263 |
if (lt_dlclose ((lt_dlhandle) handle)) |
if (scm_lt_dlclose ((scm_lt_dlhandle) handle)) |
264 |
{ |
{ |
265 |
SCM_ALLOW_INTS; |
SCM_ALLOW_INTS; |
266 |
scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL); |
scm_misc_error (subr, (char *) scm_lt_dlerror (), SCM_EOL); |
267 |
} |
} |
268 |
} |
} |
269 |
|
|
272 |
{ |
{ |
273 |
void *fptr; |
void *fptr; |
274 |
|
|
275 |
fptr = lt_dlsym ((lt_dlhandle) handle, symb); |
fptr = scm_lt_dlsym ((scm_lt_dlhandle) handle, symb); |
276 |
if (!fptr) |
if (!fptr) |
277 |
{ |
{ |
278 |
SCM_ALLOW_INTS; |
SCM_ALLOW_INTS; |
279 |
scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL); |
scm_misc_error (subr, (char *) scm_lt_dlerror (), SCM_EOL); |
280 |
} |
} |
281 |
return fptr; |
return fptr; |
282 |
} |
} |
284 |
static void |
static void |
285 |
sysdep_dynl_init () |
sysdep_dynl_init () |
286 |
{ |
{ |
287 |
lt_dlinit (); |
scm_lt_dlinit (); |
288 |
} |
} |
289 |
|
|
290 |
#else |
#else |