summaryrefslogtreecommitdiff
path: root/foreign.c
diff options
context:
space:
mode:
Diffstat (limited to 'foreign.c')
-rw-r--r--foreign.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/foreign.c b/foreign.c
index 2a61aca..cbceba4 100644
--- a/foreign.c
+++ b/foreign.c
@@ -273,6 +273,11 @@ static bool foreign_call(ForeignFnManager *ffmgr, FnExpr *fn, Type *fn_type, Val
if (!fn_ptr) {
assert(fn->flags & FN_EXPR_FOREIGN);
const char *libname = fn->foreign.lib;
+ if (!libname) {
+ err_print(call_where, "Attempt to call function at compile time which does not have an associated library.");
+ info_print(fn->where, "Function was declared here.");
+ return false;
+ }
Library *lib = str_hash_table_get(&ffmgr->libs_loaded, libname, strlen(libname));
if (!lib) {
void *handle = dlopen(libname, RTLD_LAZY);