guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: calling scheme procedures by name from C


From: Paul Emsley
Subject: Re: calling scheme procedures by name from C
Date: Sun, 02 Aug 2009 14:00:48 +0100
User-agent: Thunderbird 2.0.0.22 (X11/20090605)

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");








reply via email to

[Prev in Thread] Current Thread [Next in Thread]