1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +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:
Michael Gran 2011-03-30 20:42:37 -07:00 committed by Andy Wingo
parent e309f3bf9e
commit 0f1fd214f1
2 changed files with 10 additions and 3 deletions

View file

@ -115,9 +115,8 @@ sysdep_dynl_value (const char *symb, void *handle, const char *subr)
fptr = lt_dlsym ((lt_dlhandle) handle, symb);
if (!fptr)
{
scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL);
}
scm_misc_error (subr, "Symbol not found: ~a",
scm_list_1 (scm_from_locale_string (symb)));
return fptr;
}

View file

@ -27,6 +27,14 @@
#:use-module (srfi srfi-26)
#: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"