examples/sotest: Check that a library can be opened twice - #3691
Open
casaroli wants to merge 1 commit into
Open
Conversation
dlopen() of an already loaded library used to fail, so nothing exercised what happens when two callers hold the same object. Open the library a second time, check the same handle comes back, close one of the two and check the library is still usable through the other. Needs the counterpart change in nuttx; without it the second dlopen() returns NULL and this reports it. Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
cederom
approved these changes
Aug 3, 2026
xiaoxiang781216
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends-on: apache/nuttx#19639
Summary
dlopen()of an already loaded library used to fail, so nothing exercised what happens when two callers hold the same object.This opens the library a second time, checks the same handle comes back, closes one of the two handles and checks the library is still usable through the other.
Testing
Without apache/nuttx#19639 the second
dlopen()returnsNULLand this test reports it.Run on
lm3s6965-ekunder QEMU withCONFIG_EXAMPLES_SOTEST,CONFIG_ELF,CONFIG_LIBC_ELFandCONFIG_LIBC_DLFCN.Without apache/nuttx#19639:
With it:
The repeated
testfunc1is the library still working after one of the two handles was closed, andmodule_uninitializeis it unloading once the last one went.