[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
calling scheme procedures by name from C
From: |
Richard Shann |
Subject: |
calling scheme procedures by name from C |
Date: |
Sun, 02 Aug 2009 10:17:06 +0100 |
Hi,
I want to call a scheme procedure with four arguments from C.
(The example scheme procedure here is just displaying its arguments.)
(define (d-UploadRoutine a b c d)
(display a)
(display b)
(display c)
(display d))
But I can't find what the correct parameters types are - the headers
just say SCM, here are three things that give errors, two commented out
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"
ERROR: In procedure string->symbol:
ERROR: Wrong type argument in position 1 (expecting string): 33820865
ERROR: In procedure apply:
ERROR: Wrong type argument in position 1: d-UploadRoutine
It seems to me the docs are rather deficient here! They don't give the types of
the
arguments, and the header only tells you they are SCM...
Help much appreciated,
Richard Shann
- calling scheme procedures by name from C,
Richard Shann <=
- 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