| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.9.2 Primitive Procedures
Procedures written in C can be registered for use from Scheme,
provided they take only arguments of type SCM and return
SCM values. scm_c_define_gsubr is likely to be the most
useful mechanism, combining the process of registration
(scm_c_make_gsubr) and definition (scm_define).
- Function: SCM scm_c_make_gsubr (const char *name, int req, int opt, int rst, fcn)
Register a C procedure FCN as a “subr” — a primitive subroutine that can be called from Scheme. It will be associated with the given name but no environment binding will be created. The arguments req, opt and rst specify the number of required, optional and “rest” arguments respectively. The total number of these arguments should match the actual number of arguments to fcn, but may not exceed 10. The number of rest arguments should be 0 or 1.
scm_c_make_gsubrreturns a value of typeSCMwhich is a “handle” for the procedure.
- Function: SCM scm_c_define_gsubr (const char *name, int req, int opt, int rst, fcn)
Register a C procedure FCN, as for
scm_c_make_gsubrabove, and additionally create a top-level Scheme binding for the procedure in the “current environment” usingscm_define.scm_c_define_gsubrreturns a handle for the procedure in the same way asscm_c_make_gsubr, which is usually not further required.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on February 3, 2012 using texi2html 5.0.
