From cf28c1a2c01ccafbbee8fbf443af00d9a417146a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 28 Dec 2008 20:17:03 +0000 Subject: 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 --- src/ingen/main.cpp | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'src') 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 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 -- cgit v1.2.1