# HG changeset patch # User Chris Cannam # Date 1479312738 0 # Node ID 65b6c64992dd72dbb8aa92940f84c1fc878d211a # Parent 386de1be6226318141ed44d75dad790a473258bf If the descriptor is one of a recognised set, actually call it. This is a much more useful check against wrongly-built plugins or plugins with unavailable dependencies than just looking up the symbol diff -r 386de1be6226 -r 65b6c64992dd src/helper.cpp --- a/src/helper.cpp Thu Nov 03 16:42:46 2016 +0000 +++ b/src/helper.cpp Wed Nov 16 16:12:18 2016 +0000 @@ -139,6 +139,28 @@ else return e; } +string checkLADSPAStyleDescriptorFn(void *f) +{ + typedef const void *(*DFn)(unsigned long); + DFn fn = DFn(f); + unsigned long index = 0; + while (fn(index)) ++index; + if (index == 0) return "Library contains no plugins"; +// else cerr << "Library contains " << index << " plugin(s)" << endl; + return ""; +} + +string checkVampDescriptorFn(void *f) +{ + typedef const void *(*DFn)(unsigned int, unsigned int); + DFn fn = DFn(f); + unsigned int index = 0; + while (fn(1, index)) ++index; + if (index == 0) return "Library contains no plugins"; +// else cerr << "Library contains " << index << " plugin(s)" << endl; + return ""; +} + string check(string soname, string descriptor) { void *handle = DLOPEN(soname, RTLD_NOW | RTLD_LOCAL); @@ -152,6 +174,17 @@ " in library: " + error(); } + if (descriptor == "ladspa_descriptor") { + return checkLADSPAStyleDescriptorFn(fn); + } else if (descriptor == "dssi_descriptor") { + return checkLADSPAStyleDescriptorFn(fn); + } else if (descriptor == "vampGetPluginDescriptor") { + return checkVampDescriptorFn(fn); + } else { + cerr << "Note: no descriptor logic known for descriptor function \"" + << descriptor << "\"; not actually calling it" << endl; + } + return ""; }