diff --git a/Makefile b/Makefile index 7015597b..8b85794c 100644 --- a/Makefile +++ b/Makefile @@ -62,10 +62,10 @@ endif ifeq ($(USE_DL),0) XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) -lm -XCFLAGS := -Wall -DUSE_DL=0 -g3 -O2 $(CFLAGS) +XCFLAGS := -Wall -DUSE_DL=0 -g3 $(CFLAGS) else XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) -ldl -lm -XCFLAGS := -Wall -g3 -O2 $(CFLAGS) +XCFLAGS := -Wall -g3 $(CFLAGS) endif INCLUDES = include/chibi/sexp.h include/chibi/config.h include/chibi/install.h diff --git a/config.scm b/config.scm index 0a8f0f5c..decc94d1 100644 --- a/config.scm +++ b/config.scm @@ -53,7 +53,12 @@ (let ((mod2 (load-module (cadr x)))) (%env-copy! env (module-env mod2) (module-exports mod2)))) ((include) - (for-each (lambda (f) (load (find-module-file name f) env)) (cdr x))) + (for-each + (lambda (f) + (cond + ((find-module-file name f) => (lambda (x) (load x env))) + (else (error "couldn't find include" f)))) + (cdr x))) ((body) (for-each (lambda (expr) (eval expr env)) (cdr x))))) (module-meta-data mod)) diff --git a/eval.c b/eval.c index 3e1a1f6e..1cff2b2f 100644 --- a/eval.c +++ b/eval.c @@ -2011,10 +2011,17 @@ sexp sexp_load_dl (sexp ctx, sexp file, sexp env) { #endif sexp sexp_load (sexp ctx, sexp source, sexp env) { +#if USE_DL + char *suffix; +#endif sexp tmp, out=SEXP_FALSE; sexp_gc_var4(ctx2, x, in, res); + if (! sexp_stringp(source)) + return sexp_type_exception(ctx, "not a string", source); + if (! sexp_envp(env)) + return sexp_type_exception(ctx, "not an environment", env); #if USE_DL - char *suffix = sexp_string_data(source) + suffix = sexp_string_data(source) + sexp_string_length(source) - strlen(sexp_so_extension); if (strcmp(suffix, sexp_so_extension) == 0) { res = sexp_load_dl(ctx, source, env);