On Wed, May 15, 2024 at 10:14:36PM +0800, Kent Gibson wrote: > On Wed, May 15, 2024 at 06:54:15AM -0700, Bartosz Golaszewski wrote: > > On Wed, 15 May 2024 11:18:48 +0200, Kent Gibson <warthog618@xxxxxxxxx> said: > > > > > > > Yeah, I hate it... > > > > I wasn't expecting any love for it - it is ugly. > But it does the job. > An alternative is to extend the struct gpiod_line_request to contain a pointer to the config. The ext constructors would store their config there rather than free it. The core constructors would leave it NULL, though you would always have the option to keep a copy there later if core wants to make use of it. And gpiod_line_request_free() would free it. The ext mutators would only accept requests with the config set. That can all be conditional on extensions being part of the build. So taking advantage of the pimpl interface. Yay. Would that work for you? And I think I mis-interpreted one of your earlier mails - you want the extensions to go in their own shared library, not bundled in libgpiod.so? Though if that is the case it would be helpful to relax the use of pimpl within the lib so the extensions can access any fields not made public through the core API, as well as more efficiently access those that are. Cheers, Kent.