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
|
- Chibi > 0.11
|
||||||
- At the only 0.11 is out so build from git
|
- At the only 0.11 is out so build from git
|
||||||
- Chicken >= 5.4.0 < 6
|
- Chicken >= 5.4.0 < 6
|
||||||
|
- Gauche >= 0.9.15
|
||||||
|
- Does not yet work with snow-chibi install
|
||||||
- Guile >= 3
|
- Guile >= 3
|
||||||
|
- Does not yet work with snow-chibi install
|
||||||
- Has include bug, might not work on all situations
|
- Has include bug, might not work on all situations
|
||||||
- Kawa >= 3.11 and Java >= 22
|
- 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.abi=ALL-UNNAMED
|
||||||
- -J--add-exports=java.base/jdk.internal.foreign.layout=ALL-UNNAMED
|
- -J--add-exports=java.base/jdk.internal.foreign.layout=ALL-UNNAMED
|
||||||
- -J--add-exports=java.base/jdk.internal.foreign=ALL-UNNAMED
|
- -J--add-exports=java.base/jdk.internal.foreign=ALL-UNNAMED
|
||||||
- -J--enable-native-access=ALL-UNNAMED
|
- -J--enable-native-access=ALL-UNNAMED
|
||||||
- -J--enable-preview
|
- -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
|
- STklos > 2.10
|
||||||
- At the time only 2.10 is out so build from git
|
- 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/)
|
[https://snow-fort.org/](https://snow-fort.org/)
|
||||||
|
|
||||||
Installable with snow-chibi for following implementations.
|
snow-chibi --impls=IMPLEMENTATION install "(foreign c)"
|
||||||
|
|
||||||
- Chibi
|
You can test that library is found by your implementation like this:
|
||||||
- Kawa
|
|
||||||
- STklos
|
|
||||||
|
|
||||||
### Manul
|
cp tests/hello.scm /tmp/hello.scm
|
||||||
|
cd /tmp
|
||||||
|
IMPLEMENTATION hello.scm
|
||||||
|
|
||||||
|
### Manual
|
||||||
|
|
||||||
Either download the latest release from
|
Either download the latest release from
|
||||||
[https://git.sr.ht/~retropikzel/foreign-c/refs](https://git.sr.ht/~retropikzel/foreign-c/refs)
|
[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>
|
<li>At the only 0.11 is out so build from git</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li>Chicken >= 5.4.0 < 6</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
|
<li>Guile >= 3
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Does not yet work with snow-chibi install</li>
|
||||||
<li>Has include bug, might not work on all situations</li>
|
<li>Has include bug, might not work on all situations</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li>Kawa >= 3.11 and Java >= 22
|
<li>Kawa >= 3.11 and Java >= 22
|
||||||
|
|
@ -122,6 +127,9 @@ Schemes - 0.10.0</title>
|
||||||
<li>-J–enable-preview</li>
|
<li>-J–enable-preview</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
|
<li>Mosh >= 0.2.9-rc1</li>
|
||||||
|
<li>Racket</li>
|
||||||
|
<li>Sagittarius</li>
|
||||||
<li>STklos > 2.10
|
<li>STklos > 2.10
|
||||||
<ul>
|
<ul>
|
||||||
<li>At the time only 2.10 is out so build from git</li>
|
<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>
|
<p>Example:</p>
|
||||||
<pre><code>(define-c-library libc
|
<pre><code>(define-c-library libc
|
||||||
(list "stdlib.h")
|
(list "stdlib.h")
|
||||||
"c"
|
libc-name
|
||||||
'((additional-versions ("" "0" "6"))
|
'((additional-versions ("" "0" "6"))
|
||||||
(additional-paths ("."))))</code></pre>
|
(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>
|
<h4 id="notes">Notes</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Do not cond-expand inside the arguments, that might lead to
|
<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
|
<p>Defines a new foreign function to be used from Scheme
|
||||||
code.</p>
|
code.</p>
|
||||||
<p>Example:</p>
|
<p>Example:</p>
|
||||||
<pre><code>(cond-expand
|
<pre><code>(define-c-library libc '("stdlib.h") libc-name '("6"))
|
||||||
(windows (define-c-library libc '("stdlib.h") "ucrtbase" '()))
|
|
||||||
(else (define-c-library libc '("stdlib.h") "c" '("6"))))
|
|
||||||
(define-c-procedure c-puts libc 'puts 'int '(pointer))
|
(define-c-procedure c-puts libc 'puts 'int '(pointer))
|
||||||
(c-puts "Message brought to you by foreign-c!")</code></pre>
|
(c-puts "Message brought to you by foreign-c!")</code></pre>
|
||||||
<h4 id="notes-1">Notes</h4>
|
<h4 id="notes-1">Notes</h4>
|
||||||
|
|
@ -533,9 +537,7 @@ cp -r foreign-c/foreign snow/</code></pre>
|
||||||
code.</p>
|
code.</p>
|
||||||
<p>Example:</p>
|
<p>Example:</p>
|
||||||
<pre><code>; Load the shared library
|
<pre><code>; Load the shared library
|
||||||
(cond-expand
|
(define-c-library libc-stdlib '("stdlib.h") libc-name '("" "6"))
|
||||||
(windows (define-c-library libc-stdlib '("stdlib.h") "ucrtbase" '()))
|
|
||||||
(else (define-c-library '("stdlib.h") "c" '("" "6"))))
|
|
||||||
|
|
||||||
; Define C function that takes a callback
|
; Define C function that takes a callback
|
||||||
(define-c-procedure qsort libc-stdlib 'qsort 'void '(pointer int int 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
|
<p>Returns a newly allocated (unless empty) string whose
|
||||||
character sequence is encoded by the given c-bytevector.</p>
|
character sequence is encoded by the given c-bytevector.</p>
|
||||||
<h3 id="utilities">Utilities</h3>
|
<h3 id="utilities">Utilities</h3>
|
||||||
<p><strong>libc</strong></p>
|
<p><strong>libc-name</strong></p>
|
||||||
<p>Since the library uses C standard internally, and that is
|
<p>Name of the C standard library on the current operating
|
||||||
most likely library to have different name on different
|
system. Supported OS:</p>
|
||||||
operating systems. For example libc.so on Linux, ucrtbase.dll on
|
<ul>
|
||||||
windows and libroot.so on Haiku. It makes sense to export it,
|
<li>Windows</li>
|
||||||
saving the users the trouble of figuring out which named shared
|
<li>Linux</li>
|
||||||
library they should load.</p>
|
<li>Haiku</li>
|
||||||
|
</ul>
|
||||||
<p>See foreign/c/libc.scm to see which headers are included and
|
<p>See foreign/c/libc.scm to see which headers are included and
|
||||||
what shared libraries are loaded.</p>
|
what shared libraries are loaded.</p>
|
||||||
<p>Example:</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>
|
(c-puts "Message brought to you by foreign-c!")</code></pre>
|
||||||
<h3 id="environment-variables">Environment variables</h3>
|
<h3 id="environment-variables">Environment variables</h3>
|
||||||
<p>Setting environment variables like this on Windows works for
|
<p>Setting environment variables like this on Windows works for
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue