diff --git a/README.md b/README.md index a02a8d4..63927cf 100644 --- a/README.md +++ b/README.md @@ -266,9 +266,9 @@ Returns the size of the pffi-struct, pffi-enum or pffi-type. Returns the align of the type. -#### pffi-load +#### pffi-define-library -**pffi-load** headers shared-object-name [options] -> object +**pffi-define-library** headers shared-object-name [options] -> object Load given shared object automatically searching many predefined paths. @@ -288,13 +288,25 @@ keyword. The options are: Example: - (define libc-stdlib - (cond-expand - (windows (pffi-load (list "stdlib.h") "ucrtbase")) - (else (pffi-load (list "stdlib.h") - "c" - '(additional-versions . ("6")) - '(additional-search-paths . (".")))))) + (cond-expand + (windows (pffi-define-library libc-stdlib + (list "stdlib.h") + "ucrtbase" + '((additional-versions ("0" "6")) + (additiona-paths ("."))))) + (else (pffi-define-library libc-stdlib + (list "stdlib.h") + "c" + '((additional-versions ("0" "6")) + (additiona-paths (".")))))) + +#### Notes +- Do not cond-expand inside the arguments, that might lead to problems on some +implementations. +- Do pass the headers using quote + - As '(... and not (list... +- Do pass the options using quote + - As '(... and not (list... #### pffi-pointer-null diff --git a/retropikzel/pffi/chicken5.scm b/retropikzel/pffi/chicken5.scm index 6d18f1d..1e9afbf 100644 --- a/retropikzel/pffi/chicken5.scm +++ b/retropikzel/pffi/chicken5.scm @@ -183,7 +183,7 @@ (define-syntax pffi-shared-object-load (er-macro-transformer (lambda (expr rename compare) - (let* ((headers (cdr (car (cdr expr))))) + (let* ((headers (cadr (car (cdr expr))))) `(begin ,@ (map (lambda (header) diff --git a/tests/compliance.scm b/tests/compliance.scm index f68b623..d7de154 100755 --- a/tests/compliance.scm +++ b/tests/compliance.scm @@ -405,12 +405,11 @@ (cond-expand (windows (pffi-define-library libc-stdlib - (list "stdlib.h") + '("stdlib.h") "ucrtbase" - '((additional-versions ("0" "6"))) - )) + '((additional-versions ("0" "6"))))) (else (pffi-define-library libc-stdlib - (list "stdlib.h") + '("stdlib.h") "c" '((additional-versions ("0" "6")))))) @@ -418,18 +417,18 @@ (cond-expand (windows (pffi-define-library libc-stdio - (list "stdio.h") + '("stdio.h") "ucrtbase" '((additional-versions ("0" "6"))))) (else (pffi-define-library libc-stdio - (list "stdio.h") + '("stdio.h") "c" '((additional-versions ("0" "6")))))) (debug libc-stdio) (pffi-define-library c-testlib - (list "libtest.h") + '("libtest.h") "test" '((additional-paths ("." "./tests"))))