mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Propagate error message from unfound dynamic lib when not found as builtin either.
Fixes issue #282.
This commit is contained in:
parent
23ac772e3a
commit
8d46cc6842
1 changed files with 12 additions and 9 deletions
21
eval.c
21
eval.c
|
@ -1243,15 +1243,8 @@ static struct sexp_library_entry_t *sexp_find_static_library(const char *file)
|
|||
return entry;
|
||||
return NULL;
|
||||
}
|
||||
static sexp sexp_load_builtin (sexp ctx, sexp file, sexp env) {
|
||||
struct sexp_library_entry_t *entry = sexp_find_static_library(sexp_string_data(file));
|
||||
if (! entry)
|
||||
return sexp_compile_error(ctx, "couldn't find builtin library", file);
|
||||
return entry->init(ctx, NULL, 3, env, sexp_version, SEXP_ABI_IDENTIFIER);
|
||||
}
|
||||
#else
|
||||
#define sexp_find_static_library(path) NULL
|
||||
#define sexp_load_builtin(ctx, file, env) SEXP_UNDEF
|
||||
#endif
|
||||
|
||||
#if SEXP_USE_DL
|
||||
|
@ -1310,9 +1303,19 @@ static sexp sexp_load_dl (sexp ctx, sexp file, sexp env) {
|
|||
|
||||
#if SEXP_USE_DL || SEXP_USE_STATIC_LIBS
|
||||
static sexp sexp_load_binary(sexp ctx, sexp source, sexp env) {
|
||||
#if SEXP_USE_STATIC_LIBS
|
||||
struct sexp_library_entry_t *entry;
|
||||
#endif
|
||||
sexp res = sexp_load_dl(ctx, source, env);
|
||||
if (res == SEXP_UNDEF || sexp_exceptionp(res))
|
||||
res = sexp_load_builtin(ctx, source, env);
|
||||
#if SEXP_USE_STATIC_LIBS
|
||||
if (res == SEXP_UNDEF || sexp_exceptionp(res)) {
|
||||
entry = sexp_find_static_library(sexp_string_data(file));
|
||||
if (entry == NULL)
|
||||
res = (res == SEXP_UNDEF ? sexp_compile_error(ctx, "couldn't find builtin library", file) : res);
|
||||
else
|
||||
res = entry->init(ctx, NULL, 3, env, sexp_version, SEXP_ABI_IDENTIFIER);
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue