mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-01 21:19:16 -06:00
Add variant of gnc_engine_init which is suitable for statically the linked-in library.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18863 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
c1c706c0ef
commit
9eff25ed38
@ -72,9 +72,23 @@ gnucash_micro_version (void)
|
|||||||
* initialize backend, load any necessary databases, etc.
|
* initialize backend, load any necessary databases, etc.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
void
|
static void
|
||||||
gnc_engine_init(int argc, char ** argv)
|
gnc_engine_init_part1()
|
||||||
{
|
{
|
||||||
|
if (1 == engine_is_initialized) return;
|
||||||
|
|
||||||
|
/* initialize QOF */
|
||||||
|
qof_init();
|
||||||
|
qof_set_alt_dirty_mode(TRUE);
|
||||||
|
|
||||||
|
/* Now register our core types */
|
||||||
|
cashobjects_register();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_engine_init_part2()
|
||||||
|
{
|
||||||
|
gchar *pkglibdir = gnc_path_get_pkglibdir ();
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
const gchar* lib;
|
const gchar* lib;
|
||||||
@ -87,20 +101,7 @@ gnc_engine_init(int argc, char ** argv)
|
|||||||
{ "gncmod-backend-xml", TRUE },
|
{ "gncmod-backend-xml", TRUE },
|
||||||
{ NULL, FALSE }
|
{ NULL, FALSE }
|
||||||
}, *lib;
|
}, *lib;
|
||||||
gnc_engine_init_hook_t hook;
|
|
||||||
GList * cur;
|
|
||||||
gchar *pkglibdir;
|
|
||||||
|
|
||||||
if (1 == engine_is_initialized) return;
|
|
||||||
|
|
||||||
/* initialize QOF */
|
|
||||||
qof_init();
|
|
||||||
qof_set_alt_dirty_mode(TRUE);
|
|
||||||
|
|
||||||
/* Now register our core types */
|
|
||||||
cashobjects_register();
|
|
||||||
|
|
||||||
pkglibdir = gnc_path_get_pkglibdir ();
|
|
||||||
for (lib = libs; lib->lib ; lib++)
|
for (lib = libs; lib->lib ; lib++)
|
||||||
{
|
{
|
||||||
if (qof_load_backend_library(pkglibdir, lib->lib))
|
if (qof_load_backend_library(pkglibdir, lib->lib))
|
||||||
@ -118,17 +119,38 @@ gnc_engine_init(int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_free (pkglibdir);
|
g_free (pkglibdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_engine_init_part3(int argc, char ** argv)
|
||||||
|
{
|
||||||
|
GList * cur;
|
||||||
/* call any engine hooks */
|
/* call any engine hooks */
|
||||||
for (cur = engine_init_hooks; cur; cur = cur->next)
|
for (cur = engine_init_hooks; cur; cur = cur->next)
|
||||||
{
|
{
|
||||||
hook = (gnc_engine_init_hook_t)cur->data;
|
gnc_engine_init_hook_t hook = (gnc_engine_init_hook_t)cur->data;
|
||||||
|
|
||||||
if (hook)
|
if (hook)
|
||||||
(*hook)(argc, argv);
|
(*hook)(argc, argv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_engine_init(int argc, char ** argv)
|
||||||
|
{
|
||||||
|
gnc_engine_init_part1();
|
||||||
|
gnc_engine_init_part2();
|
||||||
|
gnc_engine_init_part3(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_engine_init_static(int argc, char ** argv)
|
||||||
|
{
|
||||||
|
gnc_engine_init_part1();
|
||||||
|
gnc_engine_init_part3(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* gnc_engine_shutdown
|
* gnc_engine_shutdown
|
||||||
* shutdown backend, destroy any global data, etc.
|
* shutdown backend, destroy any global data, etc.
|
||||||
|
@ -231,6 +231,13 @@ unsigned int gnucash_micro_version (void);
|
|||||||
* method that does not require Guile. */
|
* method that does not require Guile. */
|
||||||
void gnc_engine_init(int argc, char ** argv);
|
void gnc_engine_init(int argc, char ** argv);
|
||||||
|
|
||||||
|
/** This is the statically linked-in version of gnc_engine_init. It is
|
||||||
|
* identically to that function except that it doesn't load the
|
||||||
|
* loadable shared module, which means this function will not load the
|
||||||
|
* "(gnucash engine)" scheme module.
|
||||||
|
*/
|
||||||
|
void gnc_engine_init_static(int argc, char ** argv);
|
||||||
|
|
||||||
/** Called to shutdown the engine, see also ::qof_close
|
/** Called to shutdown the engine, see also ::qof_close
|
||||||
* for use without Guile. */
|
* for use without Guile. */
|
||||||
void gnc_engine_shutdown (void);
|
void gnc_engine_shutdown (void);
|
||||||
|
@ -175,7 +175,7 @@ main(int argc, char ** argv)
|
|||||||
|
|
||||||
qof_init();
|
qof_init();
|
||||||
gnc_module_system_init();
|
gnc_module_system_init();
|
||||||
gnc_engine_init(argc, argv);
|
gnc_engine_init_static(argc, argv);
|
||||||
|
|
||||||
// Call the statically-linked versions of the backend init
|
// Call the statically-linked versions of the backend init
|
||||||
// functions
|
// functions
|
||||||
|
Loading…
Reference in New Issue
Block a user