From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Emsley Newsgroups: gmane.lisp.guile.user Subject: Re: calling scheme procedures by name from C Date: Sun, 02 Aug 2009 14:00:48 +0100 Message-ID: <4A758E00.9040106@bioch.ox.ac.uk> References: <1249204627.2918.56.camel@debianrts.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1249218075 31091 80.91.229.12 (2 Aug 2009 13:01:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Aug 2009 13:01:15 +0000 (UTC) To: richard.shann@virgin.net, guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Aug 02 15:01:07 2009 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 1MXagS-0005UD-BE for guile-user@m.gmane.org; Sun, 02 Aug 2009 15:01:04 +0200 Original-Received: from localhost ([127.0.0.1]:48666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXagR-00060u-7a for guile-user@m.gmane.org; Sun, 02 Aug 2009 09:01:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXagI-0005z1-9i for guile-user@gnu.org; Sun, 02 Aug 2009 09:00:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXagF-0005ux-Nc for guile-user@gnu.org; Sun, 02 Aug 2009 09:00:53 -0400 Original-Received: from [199.232.76.173] (port=43681 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXagE-0005ul-OG for guile-user@gnu.org; Sun, 02 Aug 2009 09:00:51 -0400 Original-Received: from smtp819.mail.ird.yahoo.com ([77.238.189.19]:20227) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MXagD-0005qx-Uu for guile-user@gnu.org; Sun, 02 Aug 2009 09:00:50 -0400 Original-Received: (qmail 73836 invoked from network); 2 Aug 2009 13:00:48 -0000 Original-Received: from unknown (HELO ?192.168.0.11?) (paul.emsley@86.162.241.92 with plain) by smtp819.mail.ird.yahoo.com with SMTP; 2 Aug 2009 13:00:48 -0000 X-Yahoo-SMTP: IUeZZ6WswBAkJfbMfxU.UbsYh843HC0rrshqU6q7BEixHmWviE77Qqp10qHRI1w- X-YMail-OSG: byaha3sVM1lV3YGGrRS7fGpYsYJ4kdUso8jLDIlve1x17w9gL1zm1iV8fakVOKeNToJK04ti9t.ROBi0Ufftv3K8crIbjwtHiDatIwkAid1O1ceojXh3I9afdda8TrPV8a48J0WR9LxwaQB2mU2RaZqAOMs_3afXQd2emiPNd_db.t0M0Enl9TulhJI7gdY2xL1s.0D_qXYa5XdEwVSo04gXHgik44fR19X0MeQwH353L1W_kiN4O4fL7w8mVjf20yygHen9NzavB7zhG4x6b8fkwAmXem3W35bMelsGiwgGOeCEZcGQZlo9WHlCKkW_.estF.wxseoYTFl74Q-- X-Yahoo-Newman-Property: ymail-3 User-Agent: Thunderbird 2.0.0.22 (X11/20090605) In-Reply-To: <1249204627.2918.56.camel@debianrts.home> X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) 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:7386 Archived-At: Richard Shann wrote: > > SCM proc = gh_str2scm("d-UploadRoutine", strlen("d-UploadRoutine")); > // proc = scm_string_to_symbol("d-UploadRoutine"); > // proc = scm_string_to_symbol( gh_str2scm("d-UploadRoutine", strlen("d-UploadRoutine"))); > SCM arg1 = gh_str2scm("hello", strlen("hello")); > SCM arg2 = gh_str2scm("he2lo", strlen("hello")); > SCM arg3 = gh_str2scm("he3lo", strlen("hello")); > SCM arg4 = gh_str2scm("he4lo", strlen("hello")); > scm_call_4(proc, arg1, arg2, arg3, arg4); > > The three definitions of proc lead to the following three error messages: > > ERROR: In procedure apply: > ERROR: Wrong type argument in position 1: "d-UploadRoutine" > > It is indeed the wrong type of argument. Look at scm_c_define_gsubr() http://www.gnu.org/software/guile/manual/html_node/Primitive-Procedures.html Paul. and p.s. use the new style interface not the gh_* one. e.g. SCM arg1 = scm_makfrom0str("hello");