Set up the modpath correctly for Win32, OSX, and Unix in test-dynload.c

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22601 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2012-12-01 22:41:41 +00:00
parent 977ba846f7
commit c8c00253a9

View File

@ -18,17 +18,26 @@ guile_main(void *closure, int argc, char ** argv)
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);
/* Maybe MacOS? */
if (!gmodule)
gmodule = g_module_open("libgnc-module.dylib", 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);
if (gmodule)
{