Skip to content

Commit 0fa8f4f

Browse files
authored
Restore modname == NULL behavior for jl_load_dynamic_library (#49611)
Within the Julia runtime, this usage has been superseded by the new `jl_find_library_by_addr`, but this is still used downstream. In particular, CBinding.jl ends up using this branch to get a handle to libjulia-internal (perhaps a bit accidentally, since the comments in CBinding.jl suggest it intends to get a handle to the exe) This restores the behavior to avoid downstream breakage.
1 parent 5304baa commit 0fa8f4f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/dlload.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ JL_DLLEXPORT void *jl_load_dynamic_library(const char *modname, unsigned flags,
275275
int n_extensions = endswith_extension(modname) ? 1 : N_EXTENSIONS;
276276
int ret;
277277

278+
// modname == NULL is a sentinel value requesting the handle of libjulia-internal
279+
if (modname == NULL)
280+
return jl_find_dynamic_library_by_addr(&jl_load_dynamic_library);
281+
278282
abspath = jl_isabspath(modname);
279283
is_atpath = 0;
280284

0 commit comments

Comments
 (0)