From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mike Gran Newsgroups: gmane.lisp.guile.user Subject: Re: Calling a scheme procedure from C Date: Fri, 11 Jul 2003 09:20:45 -0700 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <3F0EE3DD.2070707@earthlink.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1057941439 28869 80.91.224.249 (11 Jul 2003 16:37:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 11 Jul 2003 16:37:19 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jul 11 18:37:16 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19b0tY-0007VA-00 for ; Fri, 11 Jul 2003 18:37:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19b0l4-0005rB-Vi for guile-user@m.gmane.org; Fri, 11 Jul 2003 12:28:30 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19b0kK-00054Z-Ce for guile-user@gnu.org; Fri, 11 Jul 2003 12:27:44 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19b0jo-0004HV-I4 for guile-user@gnu.org; Fri, 11 Jul 2003 12:27:15 -0400 Original-Received: from pintail.mail.pas.earthlink.net ([207.217.120.122]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19b0ho-0002Jr-9f for guile-user@gnu.org; Fri, 11 Jul 2003 12:25:08 -0400 Original-Received: from host-66-81-248-242.rev.o1.com ([66.81.248.242] helo=earthlink.net) by pintail.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19b0hm-0005lC-00 for guile-user@gnu.org; Fri, 11 Jul 2003 09:25:06 -0700 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en Original-To: guile-user@gnu.org In-Reply-To: X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2072 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2072 When you look up a Scheme function using scm_c_lookup, it doesn't return the procedure. It returns the variable that contains the procedure. To then get the procedure, you have to dereference the variable using scm_variable_ref. I would call the function this way... int main (int argc, char *argv[]) { SCM func_symbol; SCM func; scm_init_guile(); func_symbol = scm_c_lookup("write"); func = scm_variable_ref(func_symbol); scm_call_1 (func, scm_int2num(10)); exit(EXIT_SUCCESS); } _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user