[Devel] lv2_descriptor() considered harmful

David Robillard d at drobilla.net
Thu Oct 20 13:00:40 PDT 2011


On Sun, 2011-10-09 at 20:23 -0400, David Robillard wrote:
> Hi all,
> 
> The discovery mechanism we inherited from LADSPA has some problems, and
> I think it should be replaced in the next core release.
[...]

On second thought, a simpler way with less breakage would be to simply
add an lv2_init function as a separate symbol to the library, and
continue to use the existing lv2_descriptor function.

This is less implementation burden, and avoids having two discovery
functions, but loses the nice explicitness and the eliminated need for
non-portable shared library constructor/destructor hackery.

Something like:

/**
   Initialization function for a plugin library.  Hosts SHOULD call this
   function once upon loading the library, before calling
   lv2_descriptor() to access the contained plugins.
*/
int lv2_init(const char*                bundle_path,
             const LV2_Feature *const * features);

/**
   Type of the lv2_init() function in a plugin library.
*/
typedef int (*LV2_Init_Function)(const char*                bundle_path,
                                 const LV2_Feature *const * features);

Thoughts?

-dr

P.S. On the topic of initialisation, are there any considerations for
static builds we should consider?




More information about the Devel mailing list