r22601 - gnucash/trunk/src/gnc-module/test - Set up the modpath correctly for Win32, OSX, and Unix in test-dynload.c

John Ralls jralls at code.gnucash.org
Sat Dec 1 17:41:41 EST 2012


Author: jralls
Date: 2012-12-01 17:41:41 -0500 (Sat, 01 Dec 2012)
New Revision: 22601
Trac: http://svn.gnucash.org/trac/changeset/22601

Modified:
   gnucash/trunk/src/gnc-module/test/test-dynload.c
Log:
Set up the modpath correctly for Win32, OSX, and Unix in test-dynload.c

Modified: gnucash/trunk/src/gnc-module/test/test-dynload.c
===================================================================
--- gnucash/trunk/src/gnc-module/test/test-dynload.c	2012-12-01 22:41:26 UTC (rev 22600)
+++ gnucash/trunk/src/gnc-module/test/test-dynload.c	2012-12-01 22:41:41 UTC (rev 22601)
@@ -18,18 +18,27 @@
     GModule *gmodule;
     gchar *msg = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
     gchar *logdomain = "gnc.module";
+    gchar *modpath;
     guint loglevel = G_LOG_LEVEL_WARNING;
     TestErrorStruct check = { loglevel, logdomain, msg };
     g_log_set_handler (logdomain, loglevel,
                        (GLogFunc)test_checked_handler, &check);
 
     g_test_message("  test-dynload.c: testing dynamic linking of libgnc-module ...");
-    gmodule = g_module_open("libgnc-module", 0);
+#ifdef G_OS_WIN32
+/* MinGW builds libgnc-module-0.dll */
+    modpath = g_module_build_path ("../.libs", "gnc-module-0");
+#elif defined GDK_QUARTZ
+/* We build libgnc-module as a shared library for testing, and on OSX
+ * that means that g_module_build_path (), which uses ".so", doesn't
+ * build the right path name.
+ */
+    modpath = g_build_filename ("..", ".libs", "libgnc-module.dylib", NULL);
+#else /* Regular Unix */
+    modpath = g_module_build_path ("../.libs", "gnc-module");
+#endif
+    gmodule = g_module_open(modpath, 0);
 
-    /* Maybe MacOS? */
-    if (!gmodule)
-        gmodule = g_module_open("libgnc-module.dylib", 0);
-
     if (gmodule)
     {
         gpointer ptr;



More information about the gnucash-changes mailing list