unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* calling scheme procedures by name from C
@ 2009-08-02  9:17 Richard Shann
  2009-08-02 11:17 ` Linas Vepstas
  2009-08-02 13:00 ` calling scheme procedures by name from C Paul Emsley
  0 siblings, 2 replies; 13+ messages in thread
From: Richard Shann @ 2009-08-02  9:17 UTC (permalink / raw)
  To: guile-user

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







^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-08-13 23:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02  9:17 calling scheme procedures by name from C Richard Shann
2009-08-02 11:17 ` Linas Vepstas
2009-08-02 12:03   ` Richard Shann
2009-08-02 15:00   ` Mike Gran
2009-08-02 17:22     ` Linas Vepstas
2009-08-02 18:08       ` Daniel Kraft
2009-08-02 19:15         ` Linas Vepstas
2009-08-02 19:37           ` Daniel Kraft
2009-08-02 20:07             ` Linas Vepstas
2009-08-13 23:19           ` Updated Guile Tutorial Neil Jerram
2009-08-02 13:00 ` calling scheme procedures by name from C Paul Emsley
2009-08-02 13:35   ` Richard Shann
2009-08-02 19:51   ` Peter TB Brett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).