diff options
author | Michael Gran <spk121@yahoo.com> | 2011-03-30 20:42:37 -0700 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-03-31 12:34:47 +0200 |
commit | 0f1fd214f184a998a3d8e1580b7acb9d02dc879b (patch) | |
tree | 71952701761d7e97a369feca18e74394821eddba | |
parent | e309f3bf9ee910c4772353ca3ff95f6f4ef466b5 (diff) | |
download | guile-0f1fd214f184a998a3d8e1580b7acb9d02dc879b.tar.gz |
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.
-rw-r--r-- | libguile/dynl.c | 5 | ||||
-rw-r--r-- | test-suite/tests/foreign.test | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/libguile/dynl.c b/libguile/dynl.c index 2484ddaa0..a2ae6e267 100644 --- a/libguile/dynl.c +++ b/libguile/dynl.c @@ -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; } diff --git a/test-suite/tests/foreign.test b/test-suite/tests/foreign.test index 93e5fe1ca..1353e7dbb 100644 --- a/test-suite/tests/foreign.test +++ b/test-suite/tests/foreign.test @@ -28,6 +28,14 @@ #: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" (pass-if "pointer?" |