[LV2] [Devel] lv2_descriptor() considered harmful

David Robillard d at drobilla.net
Sat Feb 25 13:12:49 PST 2012


On Sat, 2012-02-25 at 13:09 -0600, Gabriel M. Beddingfield wrote:
> On 02/24/2012 05:58 PM, Martin wrote:
> > apart from getting the bundle path it would also be useful to get the
> > requested URI directly from the host (if possible).
> >
> > typedef int (*LV2_Init_Function)(const char* bundle_path,
> > const char* plugin_URI,
> > const LV2_Feature *const * features);
> 
> This looks totally wrong.  The intent for LV2_Init_Function is to 
> provide a /library/ constructor... to be executed after dlopen() opens 
> the so-file.  It has nothing to do with any specific plugin URI... and 
> if it does, then that's a mistake.  An individual plugin already has an 
> explicit init/deinit.
> 
> For example... suppose that all your plugins use a Singleton logger or 
> some kind.  You want it to be init'd on library load and destructed on 
> library close.  ATM, the only way to do this is to make your plugin in 
> C++[1] or use compiler extensions.[2]

Right, having the plugin URI as a parameter here makes no sense.  I
still prefer the original proposal that made a descriptor for the
library which contains all the functions.  Much nicer than relying on
magical hidden data, IMO.

-dr





More information about the Devel mailing list