AUDIT: r22459 - gnucash/trunk/src/libqof/qof - Try to load libgncmod_foo.dylib if libgncmod_foo.so doesn't exist
John Ralls
jralls at code.gnucash.org
Sat Oct 27 19:29:42 EDT 2012
Author: jralls
Date: 2012-10-27 19:29:42 -0400 (Sat, 27 Oct 2012)
New Revision: 22459
Trac: http://svn.gnucash.org/trac/changeset/22459
Modified:
gnucash/trunk/src/libqof/qof/qofbackend.c
Log:
Try to load libgncmod_foo.dylib if libgncmod_foo.so doesn't exist
Workaround for Darwin similar to what's already in gnc_module_refresh().
BP
Modified: gnucash/trunk/src/libqof/qof/qofbackend.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofbackend.c 2012-10-27 23:29:32 UTC (rev 22458)
+++ gnucash/trunk/src/libqof/qof/qofbackend.c 2012-10-27 23:29:42 UTC (rev 22459)
@@ -223,21 +223,30 @@
GModule *backend;
void (*module_init_func) (void);
- g_return_val_if_fail(g_module_supported(), FALSE);
- fullpath = g_module_build_path(directory, module_name);
- backend = g_module_open(fullpath, G_MODULE_BIND_LAZY);
- g_free(fullpath);
+ g_return_val_if_fail(g_module_supported (), FALSE);
+ fullpath = g_module_build_path (directory, module_name);
+/* Darwin modules can have either .so or .dylib for a suffix */
+ if (!g_file_test (fullpath, G_FILE_TEST_EXISTS) &&
+ g_strcmp0 (G_MODULE_SUFFIX, "so") == 0)
+ {
+ gchar *modname = g_strdup_printf ("lib%s.dylib", module_name);
+ g_free (fullpath);
+ fullpath = g_build_filename (directory, modname, NULL);
+ g_free (modname);
+ }
+ backend = g_module_open (fullpath, G_MODULE_BIND_LAZY);
+ g_free (fullpath);
if (!backend)
{
g_message ("%s: %s\n", PACKAGE, g_module_error ());
return FALSE;
}
- if (g_module_symbol(backend, "qof_backend_module_init",
+ if (g_module_symbol (backend, "qof_backend_module_init",
(gpointer)&module_init_func))
- module_init_func();
+ module_init_func ();
- g_module_make_resident(backend);
- backend_module_list = g_slist_prepend( backend_module_list, backend );
+ g_module_make_resident (backend);
+ backend_module_list = g_slist_prepend (backend_module_list, backend);
return TRUE;
}
More information about the gnucash-changes
mailing list