I found unusual behavior when 'import' called from url.
Code: Select all
newLISP v.10.5.4 32-bit on BSD IPv4/6 UTF-8 libffi, options: newlisp -h
> (setq url "http://lambda.que.jp/files/x.lsp")
> (get-url url)
"(import \"libc.so\" \"printf\")\n"
> (load url)
ERR: import function not found in function import : "Undefined symbol \"_nss_cac
he_cycle_prevention_function\""
http://tldp.org/HOWTO/Program-Library-H ... aries.html
Patch file here:4.3. dlsym()
...
The standard solution is to call dlerror() first (to clear any error condition that may have existed), then call dlsym() to request a symbol, then call dlerror() again to see if an error occurred. A code snippet would look like this:
Code: Select all
dlerror(); /* clear error code */ s = (actual_type) dlsym(handle, symbol_being_searched_for); if ((err = dlerror()) != NULL) { /* handle error, the symbol wasn't found */ } else { /* symbol found, its value is in s */ }
Code: Select all
diff --git a/nl-import.c b/nl-import.c
index a14264f..40a1320 100644
--- a/nl-import.c
+++ b/nl-import.c
@@ -172,6 +172,8 @@ pCell = getCell(type);
deleteList((CELL *)symbol->contents);
symbol->contents = (UINT)pCell;
+dlerror();
+
pCell->contents = (UINT)dlsym(hLibrary, funcName);
if((error = (char *)dlerror()) != NULL)