mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
More descriptive error for dynamic-pointer
* libguile/dynl.c (sysdep_dynl_value): Failure to find a symbol is not an error, so raise our own, more appropriate error. * test-suite/tests/foreign.test ("dynamic-pointer"): Add a test.
This commit is contained in:
parent
e309f3bf9e
commit
0f1fd214f1
2 changed files with 10 additions and 3 deletions
|
@ -115,9 +115,8 @@ sysdep_dynl_value (const char *symb, void *handle, const char *subr)
|
||||||
|
|
||||||
fptr = lt_dlsym ((lt_dlhandle) handle, symb);
|
fptr = lt_dlsym ((lt_dlhandle) handle, symb);
|
||||||
if (!fptr)
|
if (!fptr)
|
||||||
{
|
scm_misc_error (subr, "Symbol not found: ~a",
|
||||||
scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL);
|
scm_list_1 (scm_from_locale_string (symb)));
|
||||||
}
|
|
||||||
return fptr;
|
return fptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,14 @@
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (test-suite lib))
|
#:use-module (test-suite lib))
|
||||||
|
|
||||||
|
|
||||||
|
(with-test-prefix "dynamic-pointer"
|
||||||
|
|
||||||
|
(pass-if-exception
|
||||||
|
"error message"
|
||||||
|
'(misc-error . "^Symbol not found")
|
||||||
|
(dynamic-func "does_not_exist___" (dynamic-link))))
|
||||||
|
|
||||||
|
|
||||||
(with-test-prefix "null pointer"
|
(with-test-prefix "null pointer"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue