Sync from master

This commit is contained in:
Justin Ethier 2020-08-18 22:44:09 -04:00
parent 870abdabc6
commit 1aeff7cf66

View file

@ -17,9 +17,11 @@ title: User Manual
- [Language Details](#language-details)
- [Multithreaded Programming](#multithreaded-programming)
- [Foreign Function Interface](#foreign-function-interface)
- [Writing a Scheme Function in C](#writing-a-scheme-function-in-c)
- [Writing a Scheme Function in C](#writing-a-scheme-function-in-c)
- [Including a C Header File](#including-a-c-header-file)
- [Linking to a C Library](#linking-to-a-c-library)
- [Calling Scheme Functions from C](#calling-scheme-functions-from-c)
- [Licensing](#licensing)
- [References and Further Reading](#references-and-further-reading)
@ -216,6 +218,10 @@ Functions that may block must call the `set_thread_blocked` macro to let the sys
The Cyclone runtime can be used as a reference for how to write your own C functions. A good starting point would be [`runtime.c`](../runtime.c) and [`types.h`](../include/cyclone/types.h).
## Foreign Library
The [`(cyclone foreign)`](api/cyclone/foreign) provides a convenient interface for integrating with C code, and provides higher-level constructs than `define-c`. See the API documentation for more information.
## Including a C Header File
A C header may be included using the `include-c-header` special form. This special form may be used either as part of a library definition:
@ -244,6 +250,12 @@ A Cyclone library may use the `c-linker-options` expression to instruct the comp
(export curl-version)
(c-linker-options "-lcurl")
## Calling Scheme Functions from C
C functions `Cyc_scm_call` and `Cyc_scm_call_no_gc` are provided to allow calling Scheme functions from C.
The best way to get started with these functions is with the code examples in the Cyclone source tree under [`examples/call-scm-from-c`](../examples/call-scm-from-c).
# Licensing
Cyclone is available under the [MIT license](http://www.opensource.org/licenses/mit-license.php).