[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: calling scheme procedures by name from C
From: |
Richard Shann |
Subject: |
Re: calling scheme procedures by name from C |
Date: |
Sun, 02 Aug 2009 14:35:08 +0100 |
On Sun, 2009-08-02 at 14:00 +0100, Paul Emsley wrote:
> 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()
This is for defining scheme procedures using C. My procedure is defined
in scheme, I wanted to call it from C, for which the code in the other
response
func_symbol = scm_c_lookup("d-UploadRoutine");
proc = scm_variable_ref(func_symbol);
does the trick.
Thanks for the response,
Richard
>
> 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");
>
>
>
>
- Re: calling scheme procedures by name from C, (continued)
- Re: calling scheme procedures by name from C, Linas Vepstas, 2009/08/02
- Re: calling scheme procedures by name from C, Richard Shann, 2009/08/02
- Re: calling scheme procedures by name from C, Mike Gran, 2009/08/02
- Re: calling scheme procedures by name from C, Linas Vepstas, 2009/08/02
- Re: calling scheme procedures by name from C, Daniel Kraft, 2009/08/02
- Re: calling scheme procedures by name from C, Linas Vepstas, 2009/08/02
- Re: calling scheme procedures by name from C, Daniel Kraft, 2009/08/02
- Re: calling scheme procedures by name from C, Linas Vepstas, 2009/08/02
- Updated Guile Tutorial, Neil Jerram, 2009/08/13
Re: calling scheme procedures by name from C, Paul Emsley, 2009/08/02