1 |
/* dynl.c - dynamic linking |
/* dynl.c - dynamic linking |
2 |
* |
* |
3 |
* Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. |
* Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002 Free Software Foundation, Inc. |
4 |
* |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
91 |
sysdep_dynl_link (const char *fname, const char *subr) |
sysdep_dynl_link (const char *fname, const char *subr) |
92 |
{ |
{ |
93 |
lt_dlhandle handle; |
lt_dlhandle handle; |
94 |
handle = lt_dlopenext (fname); |
handle = scm_lt_dlopenext (fname); |
95 |
if (NULL == handle) |
if (NULL == handle) |
96 |
{ |
{ |
97 |
SCM fn; |
SCM fn; |
98 |
SCM msg; |
SCM msg; |
99 |
|
|
100 |
fn = scm_makfrom0str (fname); |
fn = scm_makfrom0str (fname); |
101 |
msg = scm_makfrom0str (lt_dlerror ()); |
msg = scm_makfrom0str (scm_lt_dlerror ()); |
102 |
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)); |
103 |
} |
} |
104 |
return (void *) handle; |
return (void *) handle; |
107 |
static void |
static void |
108 |
sysdep_dynl_unlink (void *handle, const char *subr) |
sysdep_dynl_unlink (void *handle, const char *subr) |
109 |
{ |
{ |
110 |
if (lt_dlclose ((lt_dlhandle) handle)) |
if (scm_lt_dlclose ((lt_dlhandle) handle)) |
111 |
{ |
{ |
112 |
scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL); |
scm_misc_error (subr, (char *) scm_lt_dlerror (), SCM_EOL); |
113 |
} |
} |
114 |
} |
} |
115 |
|
|
118 |
{ |
{ |
119 |
void *fptr; |
void *fptr; |
120 |
|
|
121 |
fptr = lt_dlsym ((lt_dlhandle) handle, symb); |
fptr = scm_lt_dlsym ((lt_dlhandle) handle, symb); |
122 |
if (!fptr) |
if (!fptr) |
123 |
{ |
{ |
124 |
scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL); |
scm_misc_error (subr, (char *) scm_lt_dlerror (), SCM_EOL); |
125 |
} |
} |
126 |
return fptr; |
return fptr; |
127 |
} |
} |
129 |
static void |
static void |
130 |
sysdep_dynl_init () |
sysdep_dynl_init () |
131 |
{ |
{ |
132 |
lt_dlinit (); |
scm_lt_dlinit (); |
133 |
} |
} |
134 |
|
|
135 |
scm_t_bits scm_tc16_dynamic_obj; |
scm_t_bits scm_tc16_dynamic_obj; |