There are three different ways to call C functions from Scheme, depending on how the C function was obtained.
(call-imported-binding binding arg0 ...) -> value
(call-external external arg0 ...) -> value
(call-external-value value name arg0 ...) -> value
call-imported-bindingthe function argument must be an imported binding. For
call-externalthe function argument must be an external bound in the current process (see the section on Dynamic Loading). For
valuemust be a byte vector whose contents is a pointer to a C function and
nameshould be a string naming the function. The
nameargument is used only for printing error messages.
For all of these, the C function is passed the
and the value returned is that returned by C procedure.
No automatic representation conversion occurs for either arguments or
Up to twelve arguments may be passed.
There is no method supplied for returning multiple values to
Scheme from C (or vice versa) (mainly because C does not have multiple return
Keyboard interrupts that occur during a call to a C function are ignored until the function returns to Scheme (this is clearly a problem; we are working on a solution).
nameto be a function with the given formals that applies those formals to the corresponding C binding.
C-name, if supplied, should be a string. These expand into
(define temp (lookup-imported-binding
formal...) (external-apply temp
c-name is not supplied, it is derived from
name by converting
all letters to lowercase and replacing `
-' with `
Previous: Calling C functions from Scheme | Next: Calling C functions from Scheme