Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/shared_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ rcutils_load_shared_library(
// for further reference.

#ifndef _WIN32
lib->lib_pointer = dlopen(library_path, RTLD_LAZY);
// RTLD_NODELETE: don't unmap on dlclose. Heap-resident references into the
// library (e.g. shared_ptr/weak_ptr control-block vtables) can outlive the
// dlopen/dlclose cycle; unmapping would dangle them.
lib->lib_pointer = dlopen(library_path, RTLD_LAZY | RTLD_NODELETE);
if (NULL == lib->lib_pointer) {
RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING("dlopen error: %s", dlerror());
return RCUTILS_RET_ERROR;
Expand Down