This commit is contained in:
Eric S. Londres 2021-03-22 23:53:14 -04:00
parent af9131942e
commit db7ed5dbbc
Signed by: slondr
GPG Key ID: A2D25B4D5CB970E4
1 changed files with 4 additions and 0 deletions

View File

@ -29,6 +29,10 @@ To make a Rust function available to the Guile Scheme runtime, this library prov
3. The number of optional parameters
4. An int which will be interpreted as a boolean: 1 = function has varargs, 0 = function does not have varargs
5. The function label (like the macro)
** Usage TLDR
1. Call =init_scm()=
2. Write your Rust functions and register them with =register_void_function!()= or =scm_c_define_gsubr=
3. Call =run_scm(argc, argv)= to head to the moon
* Example
Here's an example client program which defines a simple hello world function and then spawns the Scheme repl. You can run the defined Rust function from within the Repl by typing =(hello-from-rust)= and hitting enter. You'll see it prints the message into the Guile repl, and returns 0!
#+begin_src rust