diff --git a/documentation/foreign-c.html b/documentation/foreign-c.html index b088fdf..287f7b5 100644 --- a/documentation/foreign-c.html +++ b/documentation/foreign-c.html @@ -118,7 +118,7 @@ Schemes - 0.10.0
Installable with snow-chibi for following - implementations.
-snow-chibi –impls=IMPLEMENTATION install “(foreign c)”
+You can test that library is found by your implementation + like this:
+cp tests/hello.scm /tmp/hello.scm
+cd /tmp
+IMPLEMENTATION hello.scm
+ Either download the latest release from https://git.sr.ht/~retropikzel/foreign-c/refs or git clone, tag, and copy the foreign directory to diff --git a/documentation/foreign-c.pdf b/documentation/foreign-c.pdf index 24fc44a..3465d46 100644 Binary files a/documentation/foreign-c.pdf and b/documentation/foreign-c.pdf differ diff --git a/foreign/c/primitives/gambit.scm b/foreign/c/primitives/gambit.scm index 49432ad..cedc52c 100644 --- a/foreign/c/primitives/gambit.scm +++ b/foreign/c/primitives/gambit.scm @@ -46,12 +46,28 @@ ((eq? type 'void) (size-of-void*)) (else (error "Can not get size of unknown type" type))))) -(define-macro +#;(define-macro (define-c-library name headers object-name options) - (append (list `(define ,name #t) - (map (lambda (header) - `(c-declare ,(string-append "#include <" header ">"))) - (car (cdr headers)))))) + (display "HERE: ") + (write (cons `(define ,name #t) + (map (lambda (header) + `(c-declare ,(string-append "#include <" header ">"))) + (car (cdr headers))))) + (newline) + (cons `(define ,name #t) + (map (lambda (header) + `(c-declare ,(string-append "#include <" header ">"))) + (car (cdr headers))))) + +(define-macro + (define-c-library name headers object-name . options) + (begin + (let ((c-code (apply string-append + (map + (lambda (header) + (string-append "#include <" header ">" (string #\newline))) + (car (cdr headers)))))) + `(begin (define ,name #t) (c-declare ,c-code))))) (define pointer? (c-lambda ((pointer void)) bool "___return(1);"))