mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 16:27:35 +02:00
Experimenting with what an FFI could look like
This commit is contained in:
parent
e41923ad05
commit
04dda29132
1 changed files with 17 additions and 1 deletions
|
@ -1,10 +1,26 @@
|
|||
(define-library (scheme load)
|
||||
(export load)
|
||||
(export
|
||||
prim-test ;; TODO: This is just temporary, of course
|
||||
load)
|
||||
(import (scheme base)
|
||||
(scheme eval)
|
||||
(scheme file)
|
||||
(scheme read))
|
||||
(begin
|
||||
;; Experimenting with what an FFI could look like
|
||||
;; TODO: also need a way to add #include's, and later on compiler options (may already have that, need to check)
|
||||
;;
|
||||
;; want the signature to be similar to this:
|
||||
;; static void __lambda_0(void *data, int argc, closure _,object k_7322, object arg1_737, object arg2_736) {
|
||||
;; lambda portion is computed, so we can't include that.
|
||||
;; compiler would need to insert the "static void (lambda)" part
|
||||
(c-ffi:define prim-test "
|
||||
(void *data, int argc, closure _, object k, object arg1, object arg2) {
|
||||
return_closcall1(data, k, arg1);
|
||||
}
|
||||
")
|
||||
)
|
||||
;; End FFI
|
||||
(define (load filename . env)
|
||||
(let ((exprs (call-with-input-file filename
|
||||
(lambda (port)
|
||||
|
|
Loading…
Add table
Reference in a new issue