Add libc-name
This commit is contained in:
parent
afc2d6cce9
commit
b8a491e8c6
31
README.md
31
README.md
|
|
@ -85,7 +85,11 @@ to being portable by conforming to some specification.
|
||||||
|
|
||||||
Required versions:
|
Required versions:
|
||||||
|
|
||||||
|
- Chibi > 0.11
|
||||||
|
- At the only 0.11 is out so build from git
|
||||||
|
- Chicken >= 5.4.0 < 6
|
||||||
- Guile >= 3
|
- Guile >= 3
|
||||||
|
- 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
|
||||||
- -J--add-exports=java.base/jdk.internal.foreign.abi=ALL-UNNAMED
|
- -J--add-exports=java.base/jdk.internal.foreign.abi=ALL-UNNAMED
|
||||||
|
|
@ -94,6 +98,8 @@ Required versions:
|
||||||
- -J--enable-native-access=ALL-UNNAMED
|
- -J--enable-native-access=ALL-UNNAMED
|
||||||
- -J--enable-preview
|
- -J--enable-preview
|
||||||
- STklos > 2.10
|
- STklos > 2.10
|
||||||
|
- At the time only 2.10 is out so build from git
|
||||||
|
|
||||||
|
|
||||||
### Primitives 1 table
|
### Primitives 1 table
|
||||||
|
|
||||||
|
|
@ -233,12 +239,10 @@ Example:
|
||||||
|
|
||||||
(define-c-library libc
|
(define-c-library libc
|
||||||
(list "stdlib.h")
|
(list "stdlib.h")
|
||||||
"c"
|
libc-name
|
||||||
'((additional-versions ("" "0" "6"))
|
'((additional-versions ("" "0" "6"))
|
||||||
(additional-paths ("."))))
|
(additional-paths ("."))))
|
||||||
|
|
||||||
Note that libc is exported by this library so you might not need to load it.
|
|
||||||
|
|
||||||
#### Notes
|
#### Notes
|
||||||
|
|
||||||
- Do not cond-expand inside the arguments, that might lead to problems on some
|
- Do not cond-expand inside the arguments, that might lead to problems on some
|
||||||
|
|
@ -261,9 +265,7 @@ Defines a new foreign function to be used from Scheme code.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
(cond-expand
|
(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!")
|
(c-puts "Message brought to you by foreign-c!")
|
||||||
|
|
||||||
|
|
@ -311,9 +313,7 @@ Defines a new Sceme function to be used as callback to C code.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
; Load the shared library
|
; 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))
|
||||||
|
|
@ -610,19 +610,20 @@ encoded by the given c-bytevector.
|
||||||
|
|
||||||
### Utilities
|
### Utilities
|
||||||
|
|
||||||
**libc**
|
**libc-name**
|
||||||
|
|
||||||
Since the library uses C standard internally, and that is most likely library
|
Name of the C standard library on the current operating system. Supported OS:
|
||||||
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
|
- Windows
|
||||||
export it, saving the users the trouble of figuring out which named shared
|
- Linux
|
||||||
library they should load.
|
- Haiku
|
||||||
|
|
||||||
See foreign/c/libc.scm to see which headers are included and what shared
|
See foreign/c/libc.scm to see which headers are included and what shared
|
||||||
libraries are loaded.
|
libraries are loaded.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
(define-c-library libc '("stdlib.h") libc-name '("" "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!")
|
(c-puts "Message brought to you by foreign-c!")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,15 @@ Schemes - 0.10.0</title>
|
||||||
tables</h2>
|
tables</h2>
|
||||||
<p>Required versions:</p>
|
<p>Required versions:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Gambit >= 4.9.5</li>
|
<li>Chibi > 0.11
|
||||||
<li>Guile >= 3</li>
|
<ul>
|
||||||
|
<li>At the only 0.11 is out so build from git</li>
|
||||||
|
</ul></li>
|
||||||
|
<li>Chicken >= 5.4.0 < 6</li>
|
||||||
|
<li>Guile >= 3
|
||||||
|
<ul>
|
||||||
|
<li>Has include bug, might not work on all situations</li>
|
||||||
|
</ul></li>
|
||||||
<li>Kawa >= 3.11 and Java >= 22
|
<li>Kawa >= 3.11 and Java >= 22
|
||||||
<ul>
|
<ul>
|
||||||
<li>Needs arguments
|
<li>Needs arguments
|
||||||
|
|
@ -115,7 +122,10 @@ Schemes - 0.10.0</title>
|
||||||
<li>-J–enable-preview</li>
|
<li>-J–enable-preview</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li>STklos > 2.10</li>
|
<li>STklos > 2.10
|
||||||
|
<ul>
|
||||||
|
<li>At the time only 2.10 is out so build from git</li>
|
||||||
|
</ul></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3 id="primitives-1-table">Primitives 1 table</h3>
|
<h3 id="primitives-1-table">Primitives 1 table</h3>
|
||||||
<table>
|
<table>
|
||||||
|
|
@ -159,15 +169,6 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td>Gambit</td>
|
|
||||||
<td style="text-align: center;">X</td>
|
|
||||||
<td style="text-align: center;">X</td>
|
|
||||||
<td style="text-align: center;">X</td>
|
|
||||||
<td style="text-align: center;">X</td>
|
|
||||||
<td style="text-align: center;">X</td>
|
|
||||||
<td style="text-align: center;">X</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td><strong>Gauche</strong></td>
|
<td><strong>Gauche</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
@ -176,7 +177,7 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="even">
|
||||||
<td><strong>Guile</strong></td>
|
<td><strong>Guile</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
@ -185,7 +186,7 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="odd">
|
||||||
<td><strong>Kawa</strong></td>
|
<td><strong>Kawa</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
@ -194,7 +195,7 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="even">
|
||||||
<td><strong>Mosh</strong></td>
|
<td><strong>Mosh</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
@ -203,7 +204,7 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="odd">
|
||||||
<td><strong>Racket</strong></td>
|
<td><strong>Racket</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
@ -212,7 +213,7 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="even">
|
||||||
<td><strong>Sagittarius</strong></td>
|
<td><strong>Sagittarius</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
@ -221,7 +222,7 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="odd">
|
||||||
<td><strong>STklos</strong></td>
|
<td><strong>STklos</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
@ -230,7 +231,7 @@ Schemes - 0.10.0</title>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="even">
|
||||||
<td><strong>Ypsilon</strong></td>
|
<td><strong>Ypsilon</strong></td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
<td style="text-align: center;">X</td>
|
<td style="text-align: center;">X</td>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -5,10 +5,8 @@
|
||||||
(scheme process-context)
|
(scheme process-context)
|
||||||
(foreign c))
|
(foreign c))
|
||||||
|
|
||||||
|
(display "libc-name: ")
|
||||||
(display "libc-name:" )
|
|
||||||
(display libc-name)
|
(display libc-name)
|
||||||
(newline)
|
|
||||||
|
|
||||||
(define-c-library libc
|
(define-c-library libc
|
||||||
'("stdlib.h" "stdio.h" "string.h")
|
'("stdlib.h" "stdio.h" "string.h")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue