A Common Lisp to Ruby FFI
As of the current state of the project, it has some errors, but will be actively maintained
cl-ruby is not available on Quicklisp yet.
-
Clone this repo into quicklisp/local-projects, or create a symlink with the
cl-ruby.asd
file and put it in that folder. -
Be sure that libruby.dylib/so/dll is somewhere in your filesystem, but if the library can't be found, go into
cl-ruby.lisp
and change the string"libruby"
to the absolute path to where it is. -
You should be ready to go, just load the package in by evaluating
(load "cl-ruby.asd") (ql:quickload 'cl-ruby)
.
Implementation | Supported? |
---|---|
SBCL | ✅ |
CCL | ❌ Hasn't been tested |
CLISP | ❌ Needs to be compiled with dynamic FFI support. |
ECL | ✅ |
ABCL | ✅ |
Clasp | ❌ Hasn't been tested |
Allegro CL | ❌ Hasn't been tested |
LispWorks | ❌ Hasn't been tested |
-
If the Ruby VM has not been initialized and a function from
cl-ruby
has been called, a fatal memory error (segfault) will return, which may corrupt the current CL implementation image, in which you may have to restart your implementation. -
If
(init-ruby)
has been called and(ql:quickload 'cl-ruby)
is evaluated before(end-ruby)
has been called, a fatal error will occur. In SBCL, you will be navigated to the LDB, or the low-level Lisp DeBugger. To exit, just typequit
.
-
in-ruby -> Calling this multiple times will give a bunch of nasty errors on Ruby/C's side (fixing this atm)
-
end-ruby -> Gives out a segfault when called a second time
-
load-script-or-die/evaluate-or-die -> Gives out a segfault when called, no matter what
The API used for cl-ruby is available here.
Copyright (c) Ninjacop123 2019
MIT
Special thanks to zulu-inuoe for helping out with how to go about creating class/module/global methods.