Renaming, interface fixes
This commit is contained in:
parent
815e49906f
commit
f9517baf5b
|
|
@ -221,7 +221,7 @@ Takes as argument a list of C headers, these are for the compiler ones. And an s
|
||||||
used by the dynamic FFI's. The name of the shared object should not contain suffix like .so or
|
used by the dynamic FFI's. The name of the shared object should not contain suffix like .so or
|
||||||
.dll. Nor should it contain any prefix like "lib".
|
.dll. Nor should it contain any prefix like "lib".
|
||||||
|
|
||||||
Additional options argument can be provided, which should be a list of lists starting with a
|
Additional options argument can be provided, theys should be a pair with a
|
||||||
keyword. The options are:
|
keyword. The options are:
|
||||||
|
|
||||||
- additional-versions
|
- additional-versions
|
||||||
|
|
@ -236,7 +236,11 @@ Example:
|
||||||
(define libc-stdlib
|
(define libc-stdlib
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(windows (pffi-shared-object-auto-load (list "stdlib.h") "ucrtbase"))
|
(windows (pffi-shared-object-auto-load (list "stdlib.h") "ucrtbase"))
|
||||||
(else (pffi-shared-object-auto-load (list "stdlib.h") "c" '((additional-versions ("6")))))))
|
(else (pffi-shared-object-auto-load (list "stdlib.h")
|
||||||
|
"c"
|
||||||
|
'(additional-versions . ("6"))
|
||||||
|
'(additional-search-paths . ("."))))))
|
||||||
|
|
||||||
|
|
||||||
##### **pffi-shared-object-load** headers path [options]
|
##### **pffi-shared-object-load** headers path [options]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
#lang r7rs
|
#lang r7rs
|
||||||
(import (scheme base))
|
(import (scheme base))
|
||||||
(include "r7rs-pffi.sld")
|
(include "pffi.sld")
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
(define-library
|
(define-library
|
||||||
(retropikzel r7rs-pffi)
|
(retropikzel pffi)
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(chibi
|
(chibi
|
||||||
(import (scheme base)
|
(import (scheme base)
|
||||||
|
|
@ -63,33 +63,24 @@
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(gambit
|
(gambit
|
||||||
(define-macro
|
(define-macro
|
||||||
(pffi-shared-object-auto-load headers object-name options)
|
(pffi-shared-object-auto-load headers object-name . options)
|
||||||
`(pffi-shared-object-load ,(car headers))))
|
`(pffi-shared-object-load ,(car headers))))
|
||||||
(cyclone
|
|
||||||
(define-syntax pffi-shared-object-auto-load
|
|
||||||
(syntax-rules ()
|
|
||||||
((pffi-shared-object-auto-load headers object-name)
|
|
||||||
(pffi-shared-object-auto-load headers object-name (list)))
|
|
||||||
((pffi-shared-object-auto-load headers object-name options)
|
|
||||||
(pffi-shared-object-load headers)))))
|
|
||||||
(else
|
(else
|
||||||
(define-syntax pffi-shared-object-auto-load
|
(define pffi-shared-object-auto-load
|
||||||
(syntax-rules ()
|
(lambda (headers object-name . options)
|
||||||
((pffi-shared-object-auto-load headers object-name)
|
|
||||||
(pffi-shared-object-auto-load headers object-name (list)))
|
|
||||||
((pffi-shared-object-auto-load headers object-name options)
|
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(chicken (pffi-shared-object-load headers))
|
(chicken (pffi-shared-object-load headers))
|
||||||
|
(cyclone (pffi-shared-object-load headers))
|
||||||
(else
|
(else
|
||||||
(let* ((additional-paths (if (assoc 'additional-paths options)
|
(let* ((additional-paths (if (assoc 'additional-paths options)
|
||||||
(cadr (assoc 'additional-paths options))
|
(cdr (assoc 'additional-paths options))
|
||||||
(list)))
|
(list)))
|
||||||
(additional-versions (if (assoc 'additional-versions options)
|
(additional-versions (if (assoc 'additional-versions options)
|
||||||
(map (lambda (version)
|
(map (lambda (version)
|
||||||
(if (number? version)
|
(if (number? version)
|
||||||
(number->string version)
|
(number->string version)
|
||||||
version))
|
version))
|
||||||
(cadr (assoc 'additional-versions options)))
|
(cdr (assoc 'additional-versions options)))
|
||||||
(list)))
|
(list)))
|
||||||
(slash (cond-expand (windows (string #\\)) (else "/")))
|
(slash (cond-expand (windows (string #\\)) (else "/")))
|
||||||
(auto-load-paths
|
(auto-load-paths
|
||||||
|
|
@ -210,4 +201,4 @@
|
||||||
(exit 1))
|
(exit 1))
|
||||||
(pffi-shared-object-load headers
|
(pffi-shared-object-load headers
|
||||||
shared-object
|
shared-object
|
||||||
`((additional-versions ,versions))))))))))))
|
`((additional-versions ,versions)))))))))))
|
||||||
|
|
|
||||||
14
test.scm
14
test.scm
|
|
@ -2,7 +2,7 @@
|
||||||
(scheme write)
|
(scheme write)
|
||||||
(scheme char)
|
(scheme char)
|
||||||
(scheme process-context)
|
(scheme process-context)
|
||||||
(retropikzel r7rs-pffi))
|
(retropikzel pffi))
|
||||||
|
|
||||||
(define header-count 1)
|
(define header-count 1)
|
||||||
|
|
||||||
|
|
@ -392,14 +392,20 @@
|
||||||
(define libc-stdlib
|
(define libc-stdlib
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(windows (pffi-shared-object-auto-load (list "stdlib.h") "ucrtbase"))
|
(windows (pffi-shared-object-auto-load (list "stdlib.h") "ucrtbase"))
|
||||||
(else (pffi-shared-object-auto-load (list "stdlib.h") "c" '((additional-versions ("0" "6")))))))
|
(else (pffi-shared-object-auto-load (list "stdlib.h")
|
||||||
|
"c"
|
||||||
|
'(additional-versions . ("0" "6"))))))
|
||||||
|
|
||||||
(debug libc-stdlib)
|
(debug libc-stdlib)
|
||||||
|
|
||||||
(define c-testlib
|
(define c-testlib
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(windows (pffi-shared-object-auto-load (list "libtest.h") "test" '((additional-paths (".")))))
|
(windows (pffi-shared-object-auto-load (list "libtest.h")
|
||||||
(else (pffi-shared-object-auto-load (list "libtest.h") "test" '((additional-paths (".")))))))
|
"test"
|
||||||
|
'(additional-paths . ("."))))
|
||||||
|
(else (pffi-shared-object-auto-load (list "libtest.h")
|
||||||
|
"test"
|
||||||
|
'(additional-paths . ("."))))))
|
||||||
|
|
||||||
(debug c-testlib)
|
(debug c-testlib)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue