Skip to content

Commit

Permalink
[c] dlerror
Browse files Browse the repository at this point in the history
  • Loading branch information
enricozb committed Jun 24, 2024
1 parent bc1ffb5 commit 0eee14b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,12 @@ Port io_dl_call(Net* net, Book* book, Port argm) {
void* dl = readback_dylib(tup.elem_buf[0]);
Str symbol = readback_str(net, book, tup.elem_buf[1]);

dlerror();
Port (*func)(Net*, Book*, Port) = dlsym(dl, symbol.text_buf);
char* error = dlerror();
if (error != NULL) {
fprintf(stderr, "io_dl_call: failed to get symbol '%s': %s\n", symbol.text_buf, error);
}

return func(net, book, tup.elem_buf[2]);
}
Expand Down

0 comments on commit 0eee14b

Please sign in to comment.