[LV2] [Devel] lv2_descriptor() considered harmful
Gabriel M. Beddingfield
gabrbedd at gmail.com
Sat Feb 25 11:09:09 PST 2012
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]
-gabriel
[1] think: constructor/destructor of a global object
[2] e.g. for GCC using the constructor/destructor attributes.
http://tigcc.ticalc.org/doc/gnuexts.html#SEC85
More information about the Devel
mailing list