summaryrefslogtreecommitdiff
path: root/libs/ardour/control_protocol_manager.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-01-10 16:07:57 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-10 16:07:57 -0500
commit3020b224fa2d6e1b6b8a576e8e8e211e0585f2a2 (patch)
tree314c3099bcc57d9af09d249e1e7dd8e45baca642 /libs/ardour/control_protocol_manager.cc
parentd15fda6d751a465d278f477923075d4783f3b1ca (diff)
parent897fbdc652434d3aa1e67223c3c3ef7ae9be2318 (diff)
Merge windows+cc branch into cairocanvas branch. Not finished, need to now merge windows branch to get changes from there
Diffstat (limited to 'libs/ardour/control_protocol_manager.cc')
-rw-r--r--libs/ardour/control_protocol_manager.cc34
1 files changed, 19 insertions, 15 deletions
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index 974258a5c2..d9cefb44f2 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -17,7 +17,7 @@
*/
-#include <dlfcn.h>
+#include <glibmm/module.h>
#include <glibmm/fileutils.h>
@@ -29,8 +29,10 @@
#include "ardour/debug.h"
#include "ardour/control_protocol_manager.h"
+
#include "ardour/control_protocol_search_path.h"
+
using namespace ARDOUR;
using namespace std;
using namespace PBD;
@@ -211,7 +213,9 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi)
}
cpi.protocol = 0;
- dlclose (cpi.descriptor->module);
+ delete cpi.state;
+ cpi.state = 0;
+ delete (Glib::Module*)cpi.descriptor->module;
ProtocolStatusChange (&cpi);
@@ -296,7 +300,7 @@ ControlProtocolManager::control_protocol_discover (string path)
string_compose(_("Control surface protocol discovered: \"%1\"\n"), cpi->name));
}
- dlclose (descriptor->module);
+ delete (Glib::Module*)descriptor->module;
}
return 0;
@@ -305,31 +309,31 @@ ControlProtocolManager::control_protocol_discover (string path)
ControlProtocolDescriptor*
ControlProtocolManager::get_descriptor (string path)
{
- void *module;
+ Glib::Module* module = new Glib::Module(path);
ControlProtocolDescriptor *descriptor = 0;
ControlProtocolDescriptor* (*dfunc)(void);
- const char *errstr;
+ void* func = 0;
- if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
- error << string_compose(_("ControlProtocolManager: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
+ if (!(*module)) {
+ error << string_compose(_("ControlProtocolManager: cannot load module \"%1\" (%2)"), path, Glib::Module::get_last_error()) << endmsg;
+ delete module;
return 0;
}
-
- dfunc = (ControlProtocolDescriptor* (*)(void)) dlsym (module, "protocol_descriptor");
-
- if ((errstr = dlerror()) != 0) {
+ if (!module->get_symbol("protocol_descriptor", func)) {
error << string_compose(_("ControlProtocolManager: module \"%1\" has no descriptor function."), path) << endmsg;
- error << errstr << endmsg;
- dlclose (module);
+ error << Glib::Module::get_last_error() << endmsg;
+ delete module;
return 0;
}
+ dfunc = (ControlProtocolDescriptor* (*)(void))func;
descriptor = dfunc();
+
if (descriptor) {
- descriptor->module = module;
+ descriptor->module = (void*)module;
} else {
- dlclose (module);
+ delete module;
}
return descriptor;