unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Calling Scheme procedure from C ?
@ 2003-07-11  2:11 wangy01
  2003-07-13 18:18 ` Andreas Rottmann
  0 siblings, 1 reply; 2+ messages in thread
From: wangy01 @ 2003-07-11  2:11 UTC (permalink / raw)



I want to make a Scheme call "(write 10)" from my C code. I wrote:
 proc = scm_c_lookup("write");
 scm_apply(proc, SCM_MAKINUM(10), scm_listofnull);
but guile said:
        ERROR: In procedure apply:
        ERROR: Wrong type argument in position 1: #<variable 8096d70
binding: #<primitive-procedure write>>
, then I tried:
 proc = scm_c_lookup("write");
 scm_apply(proc, scm_cons(SCM_MAKINUM(10)), scm_listofnull);
guile printed the same error messages again.

What should I do?




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


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

* Re: Calling Scheme procedure from C ?
  2003-07-11  2:11 Calling Scheme procedure from C ? wangy01
@ 2003-07-13 18:18 ` Andreas Rottmann
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Rottmann @ 2003-07-13 18:18 UTC (permalink / raw)
  Cc: guile-user

"wangy01" <wangy01@mails.tsinghua.edu.cn> writes:

> I want to make a Scheme call "(write 10)" from my C code. I wrote:
>  proc = scm_c_lookup("write");
>  scm_apply(proc, SCM_MAKINUM(10), scm_listofnull);
> but guile said:
>         ERROR: In procedure apply:
>         ERROR: Wrong type argument in position 1: #<variable 8096d70
> binding: #<primitive-procedure write>>
> , then I tried:
>  proc = scm_c_lookup("write");
>  scm_apply(proc, scm_cons(SCM_MAKINUM(10)), scm_listofnull);
> guile printed the same error messages again.
>
> What should I do?
>
Some code snippet, HTH:

,----
|   SCM mod_ref_proc = scm_c_lookup("module-ref");
|   if (SCM_FALSEP(mod_ref_proc))
|     return 0;
|   SCM mod = scm_apply(
|           scm_variable_ref(mod_ref_proc),
|           scm_list_3(sobj_, scm_str2symbol(name.c_str()), SCM_BOOL_F),
|           SCM_EOL);
`----

Regards, Andy
-- 
Andreas Rottmann         | Rotty@ICQ      | 118634484@ICQ | a.rottmann@gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Python is executable pseudocode, Perl is executable line-noise.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2003-07-13 18:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-11  2:11 Calling Scheme procedure from C ? wangy01
2003-07-13 18:18 ` Andreas Rottmann

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).