[Gnucash-changes] Fix to find glade symbols on some *BSD systems.

Derek Atkins warlord at cvs.gnucash.org
Wed Feb 16 17:27:02 EST 2005


Log Message:
-----------
Fix to find glade symbols on some *BSD systems.

	* src/gnome-utils/dialog-utils.c: When trying to load the symbol
	  from a glade file, Fall back to dlsym() if g_module_symbol()
	  fails.  This is necessary to find the symbols on on certain *BSD
	  systems.

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/gnome-utils:
        dialog-utils.c

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1891
retrieving revision 1.1892
diff -LChangeLog -LChangeLog -u -r1.1891 -r1.1892
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,10 @@
+2005-02-16  Derek Atkins  <derek at ihtfp.com>
+
+	* src/gnome-utils/dialog-utils.c: When trying to load the symbol
+	  from a glade file, Fall back to dlsym() if g_module_symbol()
+	  fails.  This is necessary to find the symbols on on certain *BSD
+	  systems.
+
 2005-02-06  Chris Lyttle  <chris at wilddev.net>
 
 	* src/scm/main.scm: Update for 1.8.11 release
Index: dialog-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/dialog-utils.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -Lsrc/gnome-utils/dialog-utils.c -Lsrc/gnome-utils/dialog-utils.c -u -r1.17 -r1.18
--- src/gnome-utils/dialog-utils.c
+++ src/gnome-utils/dialog-utils.c
@@ -22,11 +22,14 @@
  *                                                                  *
 \********************************************************************/
 
+#define _GNU_SOURCE 1  /* necessary to get RTLD_DEFAULT on linux */
+
 #include "config.h"
 
 #include <glade/glade.h>
 #include <gnome.h>
 #include <gmodule.h>
+#include <dlfcn.h>
 
 #include "dialog-utils.h"
 #include "global-options.h"
@@ -38,7 +41,6 @@
 #include "gnc-euro.h"
 #include "gnc-ui-util.h"
 
-
 /* This static indicates the debugging module that this .o belongs to. */
 static short module = MOD_GUI;
 
@@ -1012,8 +1014,12 @@
   }
 
   if (!g_module_symbol(allsymbols, handler_name, (gpointer *)p_func)) {
-    g_warning("could not find signal handler '%s'.", handler_name);
-    return;
+    /* Fallback to dlsym -- necessary for *BSD linkers */
+    func = dlsym(RTLD_DEFAULT, handler_name);
+    if (func == NULL) {
+      g_warning("ggaff: could not find signal handler '%s'.", handler_name);
+      return;
+    }
   }
 
   if (other_object) {


More information about the gnucash-changes mailing list