diff --git a/pyml_stubs.c b/pyml_stubs.c index 9cb696f..81e9d05 100644 --- a/pyml_stubs.c +++ b/pyml_stubs.c @@ -39,7 +39,13 @@ open_library(const char *filename) return LoadLibrary(filename); } -void +static char * +get_library_error() +{ + return "Unable to load library"; +} + +static void close_library(library_t library) { if (!FreeLibrary(library)) { @@ -90,6 +96,12 @@ open_library(const char *filename) return dlopen(filename, RTLD_LAZY | RTLD_GLOBAL); } +static char * +get_library_error() +{ + return dlerror(); +} + void close_library(library_t filename) { @@ -660,7 +672,7 @@ py_load_library(value filename_ocaml, value debug_build_ocaml) const char *filename = String_val(Field(filename_ocaml, 0)); library = open_library(filename); if (!library) { - failwith("Library not found"); + failwith(get_library_error()); } } else {