Skip to content

Commit

Permalink
add nothrow variant of jl_get_library
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Dec 20, 2019
1 parent 608567f commit d92f2ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,8 @@ extern void *jl_crtdll_handle;
extern void *jl_winsock_handle;
#endif

void *jl_get_library(const char *f_lib);
void *jl_get_library_(const char *f_lib, int throw_err);
#define jl_get_library(f_lib) jl_get_library_(f_lib, 1)
JL_DLLEXPORT void *jl_load_and_lookup(const char *f_lib, const char *f_name,
void **hnd);
JL_DLLEXPORT jl_value_t *jl_get_cfunction_trampoline(
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace llvm;
static std::map<std::string, void*> libMap;
static jl_mutex_t libmap_lock;
extern "C"
void *jl_get_library(const char *f_lib)
void *jl_get_library_(const char *f_lib, int throw_err)
{
void *hnd;
#ifdef _OS_WINDOWS_
Expand All @@ -47,7 +47,7 @@ void *jl_get_library(const char *f_lib)
if (hnd != NULL)
return hnd;
// We might run this concurrently on two threads but it doesn't matter.
hnd = jl_load_dynamic_library(f_lib, JL_RTLD_DEFAULT, 1);
hnd = jl_load_dynamic_library(f_lib, JL_RTLD_DEFAULT, throw_err);
if (hnd != NULL)
jl_atomic_store_release(map_slot, hnd);
return hnd;
Expand Down

0 comments on commit d92f2ff

Please sign in to comment.