Skip to content

Load DCCL codec plugin shared libraries from AppConfig and GOBY_LOAD_SHARED_LIBRARY - #400

Open
tsaubergine with Copilot wants to merge 3 commits into
3.0from
copilot/cleaner-loading-of-dccl-libraries
Open

Load DCCL codec plugin shared libraries from AppConfig and GOBY_LOAD_SHARED_LIBRARY#400
tsaubergine with Copilot wants to merge 3 commits into
3.0from
copilot/cleaner-loading-of-dccl-libraries

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

External DCCL codec plugins (libdccl_arithmetic.so, libdccl_native_protobuf.so) had no general loading path: only a handful of apps (pAcommsHandler, goby_bridge, goby_liaison, goby_logger) had a bespoke load_shared_library option, none of which registered codecs with the middleware DCCL codec used by the intervehicle layer, and gobyd had no option at all.

This adds a single loading mechanism at the goby::middleware::Application level, so it works for every Goby app including gobyd.

# config
app { load_shared_library: "libdccl_arithmetic.so" }

# or environment (':', ';' or ',' separated)
export GOBY_LOAD_SHARED_LIBRARY=libdccl_arithmetic.so:libdccl_native_protobuf.so

Changes

  • AppConfig: new repeated string load_shared_library = 60 (ADVANCED). Each entry may itself contain several libraries separated by :, ; or ,, matching the existing ToolSharedLibraryLoader convention.
  • DCCLSerializerParserHelperBase::load_library(): the std::string wrapper around dccl::Codec::load_library() is replaced by an implementation that dlopens with RTLD_LAZY | RTLD_NODELETE (consistent with the rest of Goby, and avoiding dccl's dlclose-on-destruct which can leave dangling Protobuf descriptor memory) and throws goby::Exception on failure. Handles are tracked and de-duplicated, and re-applied whenever the codec is created or replaced (codec() / set_codec()). A void* overload is added for already-opened handles.
  • Application: new load_shared_libraries() invoked from the constructor after logger setup and before any DCCL use; reads GOBY_LOAD_SHARED_LIBRARY first, then config entries.
  • ToolSharedLibraryLoader: libraries opened by goby zeromq publish/subscribe (-l / GOBY_TOOL_LOAD_SHARED_LIBRARY) are now also registered with the DCCL codec, so plugin codecs they contain are usable.
  • Test src/test/middleware/dccl_load_library: a message using the external dccl.native_protobuf codec throws before loading and round-trips after; repeat loads are a no-op; a missing library throws.
  • Docs: "Loading shared libraries (DCCL plugins)" section in doc230_application.md.

Notes for review

  • GOBY_LOAD_SHARED_LIBRARY is read explicitly rather than via (goby.field).cfg.env, since env bindings are only generated for top-level config fields and AppConfig is nested under app.
  • Existing per-app load_shared_library options are left untouched; this is additive.

Co-authored-by: tsaubergine <732276+tsaubergine@users.noreply.github.com>
Copilot AI changed the title [WIP] Find cleaner way to load external shared libraries for DCCL plugins Load DCCL codec plugin shared libraries from AppConfig and GOBY_LOAD_SHARED_LIBRARY Aug 7, 2026
Copilot AI requested a review from tsaubergine August 7, 2026 07:19
@tsaubergine
tsaubergine marked this pull request as ready for review August 12, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need cleaner way to load external shared libraries containing DCCL plugins into apps and gobyd

2 participants