diff options
author | David Robillard <d@drobilla.net> | 2008-12-28 20:17:03 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-12-28 20:17:03 +0000 |
commit | cf28c1a2c01ccafbbee8fbf443af00d9a417146a (patch) | |
tree | 00ffa4494cd2451ebafccb18ea14a9d98242913a /src | |
parent | ca10a6e1e825edbad014b96a6b69becb5a8ab758 (diff) | |
download | ingen-cf28c1a2c01ccafbbee8fbf443af00d9a417146a.tar.gz ingen-cf28c1a2c01ccafbbee8fbf443af00d9a417146a.tar.bz2 ingen-cf28c1a2c01ccafbbee8fbf443af00d9a417146a.zip |
Check for successful load of GUI and scripting modules.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1915 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/ingen/main.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index f1f2aa1c..0e50faa2 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -227,15 +227,19 @@ main(int argc, char** argv) bool run_gui = false; if (args.gui_given) { gui_module = Ingen::Shared::load_module("ingen_gui"); - void (*init)(int, char**, Ingen::Shared::World*); - - bool found = gui_module->get_symbol("init", (void*&)init); - found = found && gui_module->get_symbol("run", (void*&)gui_run); - if (found) { - run_gui = true; - init(argc, argv, world); + if (gui_module) { + void (*init)(int, char**, Ingen::Shared::World*); + + bool found = gui_module->get_symbol("init", (void*&)init); + found = found && gui_module->get_symbol("run", (void*&)gui_run); + if (found) { + run_gui = true; + init(argc, argv, world); + } else { + cerr << "Unable to find hooks in GUI module, GUI not loaded." << endl; + } } else { - cerr << "Unable to find hooks in GUI module, GUI not loaded." << endl; + cerr << "Unable to load GUI module." << endl; } } @@ -300,18 +304,19 @@ main(int argc, char** argv) #ifdef WITH_BINDINGS bool (*run_script)(Ingen::Shared::World*, const char*) = NULL; SharedPtr<Glib::Module> bindings_module = Ingen::Shared::load_module("ingen_bindings"); - if (!bindings_module) + if (bindings_module) { + bindings_module->make_resident(); + + bool found = bindings_module->get_symbol("run", (void*&)(run_script)); + if (found) { + setenv("PYTHONPATH", "../../bindings", 1); + run_script(world, args.run_arg); + } else { + cerr << "FAILED: " << Glib::Module::get_last_error() << endl; + } + } else { cerr << Glib::Module::get_last_error() << endl; - - bindings_module->make_resident(); - - bool found = bindings_module->get_symbol("run", (void*&)(run_script)); - if (found) { - setenv("PYTHONPATH", "../../bindings", 1); - run_script(world, args.run_arg); - } else { - cerr << "FAILED: " << Glib::Module::get_last_error() << endl; - } + } #else cerr << "This build of ingen does not support scripting." << endl; #endif |