diff --git a/README.md b/README.md index 47dad40..a584bb2 100644 --- a/README.md +++ b/README.md @@ -88,15 +88,24 @@ Required versions: - Chibi > 0.11 - At the only 0.11 is out so build from git - Chicken >= 5.4.0 < 6 +- Gauche >= 0.9.15 + - Does not yet work with snow-chibi install - Guile >= 3 + - Does not yet work with snow-chibi install - Has include bug, might not work on all situations - Kawa >= 3.11 and Java >= 22 - - Needs arguments + - Needs arguments to enable FFI - -J--add-exports=java.base/jdk.internal.foreign.abi=ALL-UNNAMED - -J--add-exports=java.base/jdk.internal.foreign.layout=ALL-UNNAMED - -J--add-exports=java.base/jdk.internal.foreign=ALL-UNNAMED - -J--enable-native-access=ALL-UNNAMED - -J--enable-preview + - So that snow-chibi installed library is found + - -Dkawa.import.path=/usr/local/share/kawa + - -Dkawa.import.path=/usr/local/share/kawa/lib +- Mosh >= 0.2.9-rc1 +- Racket >= 8.16 [cs] +- Sagittarius >= 0.9.13 - STklos > 2.10 - At the time only 2.10 is out so build from git @@ -152,13 +161,15 @@ Required versions: [https://snow-fort.org/](https://snow-fort.org/) -Installable with snow-chibi for following implementations. +snow-chibi --impls=IMPLEMENTATION install "(foreign c)" -- Chibi -- Kawa -- STklos +You can test that library is found by your implementation like this: -### Manul + cp tests/hello.scm /tmp/hello.scm + cd /tmp + IMPLEMENTATION hello.scm + +### Manual Either download the latest release from [https://git.sr.ht/~retropikzel/foreign-c/refs](https://git.sr.ht/~retropikzel/foreign-c/refs) diff --git a/documentation/foreign-c.html b/documentation/foreign-c.html index ffa34c6..b088fdf 100644 --- a/documentation/foreign-c.html +++ b/documentation/foreign-c.html @@ -107,8 +107,13 @@ Schemes - 0.10.0
Example:
(define-c-library libc
(list "stdlib.h")
- "c"
+ libc-name
'((additional-versions ("" "0" "6"))
(additional-paths ("."))))
- Note that libc is exported by this library so you might not - need to load it.
Defines a new foreign function to be used from Scheme code.
Example:
-(cond-expand
- (windows (define-c-library libc '("stdlib.h") "ucrtbase" '()))
- (else (define-c-library libc '("stdlib.h") "c" '("6"))))
+ (define-c-library libc '("stdlib.h") libc-name '("6"))
(define-c-procedure c-puts libc 'puts 'int '(pointer))
(c-puts "Message brought to you by foreign-c!")
Notes
@@ -533,9 +537,7 @@ cp -r foreign-c/foreign snow/
code.
Example:
; Load the shared library
-(cond-expand
- (windows (define-c-library libc-stdlib '("stdlib.h") "ucrtbase" '()))
- (else (define-c-library '("stdlib.h") "c" '("" "6"))))
+(define-c-library libc-stdlib '("stdlib.h") libc-name '("" "6"))
; Define C function that takes a callback
(define-c-procedure qsort libc-stdlib 'qsort 'void '(pointer int int callback))
@@ -825,17 +827,19 @@ func(&i);
Returns a newly allocated (unless empty) string whose character sequence is encoded by the given c-bytevector.
libc
-Since the library uses C standard internally, and that is - most likely library to have different name on different - operating systems. For example libc.so on Linux, ucrtbase.dll on - windows and libroot.so on Haiku. It makes sense to export it, - saving the users the trouble of figuring out which named shared - library they should load.
+libc-name
+Name of the C standard library on the current operating + system. Supported OS:
+See foreign/c/libc.scm to see which headers are included and what shared libraries are loaded.
Example:
-(define-c-procedure c-puts libc 'puts 'int '(pointer))
+ (define-c-library libc '("stdlib.h") libc-name '("" "6"))
+(define-c-procedure c-puts libc 'puts 'int '(pointer))
(c-puts "Message brought to you by foreign-c!")
Environment variables
Setting environment variables like this on Windows works for
diff --git a/documentation/foreign-c.pdf b/documentation/foreign-c.pdf
index 4aac401..24fc44a 100644
Binary files a/documentation/foreign-c.pdf and b/documentation/foreign-c.pdf differ