[Gnucash-changes] r12816 - gnucash/trunk/src - Pull the C inner_main into the environment of the guile (gnucash main) module.

Chris Shoemaker chris at cvs.gnucash.org
Mon Jan 16 21:26:17 EST 2006


Author: chris
Date: 2006-01-16 21:26:16 -0500 (Mon, 16 Jan 2006)
New Revision: 12816
Trac: http://svn.gnucash.org/trac/changeset/12816

Modified:
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/scm/main.scm
Log:
Pull the C inner_main into the environment of the guile (gnucash main) module.

Strangely, symbols that are resolved during a dlopen() *before* calling 
scm_set_current_module() are not resolvable from guile code that is inside 
a module. 

In order for code in a guile module to see symbols from dlopen'ed libraries,
they must be dlopen'ed *while* that guile module is current.  I imagine this
is because the process of changing the current guile module purposely hides 
all symbols in the current symbol table - to create an illusion of an empty
table.  Kinda interesting... kinda scary...


Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2006-01-17 01:42:46 UTC (rev 12815)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2006-01-17 02:26:16 UTC (rev 12816)
@@ -32,9 +32,15 @@
 static void
 inner_main (void *closure, int argc, char **argv)
 {
+    SCM main_mod;
+
+    main_mod = scm_c_resolve_module("gnucash main");
+    scm_set_current_module(main_mod);
+
     /* module initializations would go here */
-    //scm_c_eval_string("(display %load-path)");
-    scm_c_eval_string("(use-modules (gnucash main))");
+    gnc_module_load("gnucash/app-utils", 0);
+    gnc_module_load("gnucash/gw-engine", 0);
+
     scm_c_eval_string("(gnc:main)");
     return;
 }

Modified: gnucash/trunk/src/scm/main.scm
===================================================================
--- gnucash/trunk/src/scm/main.scm	2006-01-17 01:42:46 UTC (rev 12815)
+++ gnucash/trunk/src/scm/main.scm	2006-01-17 02:26:16 UTC (rev 12816)
@@ -370,9 +370,6 @@
   (let ((original-module (current-module))
         (bootstrap (resolve-module '(gnucash main))))
     
-    (set-current-module bootstrap)
-    
-    (gnc:module-load "gnucash/app-utils" 0)
     ;; Now we can load a bunch of files.
     (load-from-path "path.scm")
     (load-from-path "command-line.scm") ;; depends on app-utils (N_, etc.)...



More information about the gnucash-changes mailing list