Update readme
This commit is contained in:
parent
b8a491e8c6
commit
f2cf940aa6
23
README.md
23
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)
|
||||
|
|
|
|||
|
|
@ -107,8 +107,13 @@ Schemes - 0.10.0</title>
|
|||
<li>At the only 0.11 is out so build from git</li>
|
||||
</ul></li>
|
||||
<li>Chicken >= 5.4.0 < 6</li>
|
||||
<li>Gauche >= 0.9.15
|
||||
<ul>
|
||||
<li>Does not yet work with snow-chibi install</li>
|
||||
</ul></li>
|
||||
<li>Guile >= 3
|
||||
<ul>
|
||||
<li>Does not yet work with snow-chibi install</li>
|
||||
<li>Has include bug, might not work on all situations</li>
|
||||
</ul></li>
|
||||
<li>Kawa >= 3.11 and Java >= 22
|
||||
|
|
@ -122,6 +127,9 @@ Schemes - 0.10.0</title>
|
|||
<li>-J–enable-preview</li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
<li>Mosh >= 0.2.9-rc1</li>
|
||||
<li>Racket</li>
|
||||
<li>Sagittarius</li>
|
||||
<li>STklos > 2.10
|
||||
<ul>
|
||||
<li>At the time only 2.10 is out so build from git</li>
|
||||
|
|
@ -456,11 +464,9 @@ cp -r foreign-c/foreign snow/</code></pre>
|
|||
<p>Example:</p>
|
||||
<pre><code>(define-c-library libc
|
||||
(list "stdlib.h")
|
||||
"c"
|
||||
libc-name
|
||||
'((additional-versions ("" "0" "6"))
|
||||
(additional-paths ("."))))</code></pre>
|
||||
<p>Note that libc is exported by this library so you might not
|
||||
need to load it.</p>
|
||||
<h4 id="notes">Notes</h4>
|
||||
<ul>
|
||||
<li>Do not cond-expand inside the arguments, that might lead to
|
||||
|
|
@ -485,9 +491,7 @@ cp -r foreign-c/foreign snow/</code></pre>
|
|||
<p>Defines a new foreign function to be used from Scheme
|
||||
code.</p>
|
||||
<p>Example:</p>
|
||||
<pre><code>(cond-expand
|
||||
(windows (define-c-library libc '("stdlib.h") "ucrtbase" '()))
|
||||
(else (define-c-library libc '("stdlib.h") "c" '("6"))))
|
||||
<pre><code>(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!")</code></pre>
|
||||
<h4 id="notes-1">Notes</h4>
|
||||
|
|
@ -533,9 +537,7 @@ cp -r foreign-c/foreign snow/</code></pre>
|
|||
code.</p>
|
||||
<p>Example:</p>
|
||||
<pre><code>; 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);</code></pre>
|
|||
<p>Returns a newly allocated (unless empty) string whose
|
||||
character sequence is encoded by the given c-bytevector.</p>
|
||||
<h3 id="utilities">Utilities</h3>
|
||||
<p><strong>libc</strong></p>
|
||||
<p>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.</p>
|
||||
<p><strong>libc-name</strong></p>
|
||||
<p>Name of the C standard library on the current operating
|
||||
system. Supported OS:</p>
|
||||
<ul>
|
||||
<li>Windows</li>
|
||||
<li>Linux</li>
|
||||
<li>Haiku</li>
|
||||
</ul>
|
||||
<p>See foreign/c/libc.scm to see which headers are included and
|
||||
what shared libraries are loaded.</p>
|
||||
<p>Example:</p>
|
||||
<pre><code>(define-c-procedure c-puts libc 'puts 'int '(pointer))
|
||||
<pre><code>(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!")</code></pre>
|
||||
<h3 id="environment-variables">Environment variables</h3>
|
||||
<p>Setting environment variables like this on Windows works for
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue