From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Fang Newsgroups: gmane.lisp.guile.user Subject: modules and C Date: Wed, 21 Mar 2007 17:57:25 -0500 (EST) Message-ID: <20070321173609.K46895-100000@shannon.csl.cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1174517872 30140 80.91.229.12 (21 Mar 2007 22:57:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 21 Mar 2007 22:57:52 +0000 (UTC) To: Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Mar 21 23:57:46 2007 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HU9kQ-0003wn-Ko for guile-user@m.gmane.org; Wed, 21 Mar 2007 23:57:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HU9m9-0004W7-3O for guile-user@m.gmane.org; Wed, 21 Mar 2007 17:59:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HU9m5-0004Tz-42 for guile-user@gnu.org; Wed, 21 Mar 2007 18:59:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HU9m3-0004OG-KQ for guile-user@gnu.org; Wed, 21 Mar 2007 18:59:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HU9m3-0004O1-II for guile-user@gnu.org; Wed, 21 Mar 2007 17:59:19 -0500 Original-Received: from shannon.csl.cornell.edu ([128.84.224.88]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HU9kK-000446-46 for guile-user@gnu.org; Wed, 21 Mar 2007 18:57:32 -0400 Original-Received: from localhost (fang@localhost) by shannon.csl.cornell.edu (8.11.3/8.9.2) with ESMTP id l2LMvP247130 for ; Wed, 21 Mar 2007 17:57:25 -0500 (EST) (envelope-from fang@shannon.csl.cornell.edu) X-Authentication-Warning: shannon.csl.cornell.edu: fang owned process doing -bs X-detected-kernel: FreeBSD 2.0-4.2 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5883 Archived-At: Hi, I'm having a bit of trouble using a symbol I defined in C from a module: In a .cc file, I've defined some_C_function(), and exposed it to guile via scm_c_define_gsubr("some-C-function", ...), which is called upon initialization as part of an inner_main() passed to scm_shell(). The program loads up fine, and I'm able to interactively call (some-C-function) in the interpreter. In a .scm module file, I (define-module (foo bar)) and (define-public (blah x) (some-C-function x)). I run my program again (with a GUILE_LOAD_PATH to the new .scm), guile> (use-modules (foo bar)) I see both 'some-C-function' and 'blah' are available procedures, but as soon as I call (blah ...), I get "Unbound variable: some-C-function" guile> blah # guile> some-C-function # guile> (blah 1) Backtrace: In current input: 5: 0* [blah ] In ../../../../src/scm/foo/bar.scm: 48: 1 (some-C-function x) which indicates that my C-wrapped functions aren't visible to the newly defined module, even through they are present in the interpreter's environment. What do I need to do to export my scm_c_define_gsubr'd functions to the module? Must I wrap them into another module in C, and use-module it? (Would I expect the same problem with mixing load-extensions with modules?) I've been reading the manuals and info on the module's sections and didn't find a satisfactory answer. (Is this a 'quirk?') What basic concept(s) am I missing here? Thanks in advance! Fang _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user