-
- if(gmodule != NULL) {
- g_message("Loading module %s ... found!",pathname);
-
- /* Was the module already opened? */
- moduleInfo = g_hash_table_lookup(modules,g_module_name(gmodule));
-
- /* First time the module is opened */
-
- if(moduleInfo == NULL ) {
- moduleInfo = g_new(lttv_module_info, 1);
- moduleInfo->module = gmodule;
- moduleInfo->pathname = g_module_name(gmodule);
- moduleInfo->directory = modulesPaths->pdata[i];
- moduleInfo->name = (char *)g_strdup(name);
- moduleInfo->ref_count = 0;
- moduleInfo->index_standalone = -1;
- g_hash_table_insert(modules, moduleInfo->pathname, moduleInfo);
- if(!g_module_symbol(gmodule, "init", (gpointer) &init_Function)) {
- g_critical("module %s (%s) does not have init function",
- moduleInfo->pathname,moduleInfo->name);
- }
- else {
- init_Function(argc,argv);
- }
- }
-
- /* Add the module in the standalone array if the module is
- * standalone and not in the array. Otherwise, set index to
- * -1 (dependant only).
- */
- if(load == STANDALONE) {
-
- if(moduleInfo->index_standalone == -1) {
-
- g_ptr_array_add(modulesStandalone, moduleInfo);
- moduleInfo->index_standalone = modulesStandalone->len - 1;
-
- moduleInfo->ref_count++ ;
- }
- else {
- g_warning("Module %s is already loaded standalone.",pathname);
- /* Decrease the gmodule use_count. Has previously been increased in the g_module_open. */
- g_module_close(moduleInfo->module) ;
- }
- }
- else { /* DEPENDANT */
- moduleInfo->ref_count++ ;
- }
-
- return moduleInfo;
- }
- g_message("Loading module %s ... missing.",pathname);