summaryrefslogtreecommitdiffstats
path: root/src/instance.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-03-18 12:02:05 +0100
committerDavid Robillard <d@drobilla.net>2017-03-18 12:05:15 +0100
commit43a25ed63a9144afe32a4fea520412770394822c (patch)
tree67c7aa044726304b71794f64316ad68d29758325 /src/instance.c
parent64a2647d8d81b5c23d22b52cc9e0dd2595270b67 (diff)
downloadsuil-43a25ed63a9144afe32a4fea520412770394822c.tar.gz
suil-43a25ed63a9144afe32a4fea520412770394822c.tar.bz2
suil-43a25ed63a9144afe32a4fea520412770394822c.zip
Add suil_init()
This allows the actual host argc and argv to be passed to QApplication if it is created by Suil (for Qt in non-Qt cases), and initializes X11 threads to fix Qt5 in Gtk2.
Diffstat (limited to 'src/instance.c')
-rw-r--r--src/instance.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/instance.c b/src/instance.c
index f05cc86..2563bf6 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -143,25 +143,8 @@ open_wrapper(SuilHost* host,
return NULL;
}
- const char* const env_dir = getenv("SUIL_MODULE_DIR");
- const char* const mod_dir = env_dir ? env_dir : SUIL_MODULE_DIR;
-
- const size_t path_len = strlen(mod_dir)
- + strlen(SUIL_DIR_SEP SUIL_MODULE_PREFIX SUIL_MODULE_EXT)
- + strlen(module_name)
- + 2;
-
- char* const path = (char*)calloc(path_len, 1);
- snprintf(path, path_len, "%s%s%s%s%s",
- mod_dir, SUIL_DIR_SEP,
- SUIL_MODULE_PREFIX, module_name, SUIL_MODULE_EXT);
-
- // Open wrap module
- dlerror();
- void* lib = dlopen(path, RTLD_NOW);
+ void* const lib = suil_open_module(module_name);
if (!lib) {
- SUIL_ERRORF("Unable to open wrap module %s (%s)\n", path, dlerror());
- free(path);
return NULL;
}
@@ -176,17 +159,13 @@ open_wrapper(SuilHost* host,
n_features)
: NULL;
- if (!wrapper) {
- SUIL_ERRORF("Corrupt module %s\n", path);
+ if (wrapper) {
+ wrapper->lib = lib;
+ } else {
+ SUIL_ERRORF("Corrupt wrap module %s\n", module_name);
dlclose(lib);
- free(path);
- return NULL;
}
- free(path);
-
- wrapper->lib = lib;
-
return wrapper;
}