feat(#461): Optional CLI plugin loader via dlopen#502
Merged
Conversation
…types Add io_plugin_dlopen combo option (default disabled) to meson_options.txt. Define WL_IO_PLUGIN_EXPORT visibility macro and wl_io_plugin_entry_fn typedef in io_adapter.h for the Path B plugin contract (#446 section 7).
Add plugin_loader.c/.h implementing dlopen + dlsym("wl_io_plugin_entry")
+ ABI version validation + bulk adapter registration with fail-fast
semantics. Tracks loaded plugins for clean dlclose at shutdown.
Single-threaded CLI-only module, not thread-safe by design.
Add repeatable --load-adapter=PATH argument to CLI main.c, gated behind WL_HAVE_PLUGIN_LOADER define. Update meson.build to conditionally link libdl and include plugin_loader.c when io_plugin_dlopen=enabled. Excluded from Windows builds.
Add test_plugin_loader.c exercising: valid load + register + find, unload cleanup, ABI mismatch rejection, missing file error, NULL path error. Build mock_plugin_adapter.so (valid) and mock_plugin_adapter_bad_abi.so (always returns NULL) as test-only shared libraries. Tests gated behind io_plugin_dlopen=enabled.
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.
Summary
io_plugin_dlopenmeson option (default disabled) for optional CLI plugin loadingWL_IO_PLUGIN_EXPORTmacro andwl_io_plugin_entry_fntypedef inio_adapter.h(Path B contract from feat: Option C user-defined I/O adapters (static + Android + optional CLI dlopen) #446)wirelog/cli/plugin_loader.cwithdlopen+dlsym("wl_io_plugin_entry")+ ABI version check + fail-fast bulk registration--load-adapter=PATHCLI argument inmain.c, gated behindWL_HAVE_PLUGIN_LOADERlibdllinking, excluded from Windows buildsTest plan
-Dio_plugin_dlopen=enabled: compiles and links--load-adapterwith valid plugin: loads successfully--load-adapterwith missing file: clear error messageCloses #461