diff --git a/README.md b/README.md index 5f281ed..47dad40 100644 --- a/README.md +++ b/README.md @@ -85,15 +85,21 @@ to being portable by conforming to some specification. Required versions: +- Chibi > 0.11 + - At the only 0.11 is out so build from git +- Chicken >= 5.4.0 < 6 - Guile >= 3 + - Has include bug, might not work on all situations - Kawa >= 3.11 and Java >= 22 - - Needs arguments - - -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 + - Needs arguments + - -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 - STklos > 2.10 + - At the time only 2.10 is out so build from git + ### Primitives 1 table @@ -233,12 +239,10 @@ 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. - #### Notes - 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: - (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!") @@ -311,9 +313,7 @@ Defines a new Sceme function to be used as callback to C 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)) @@ -610,19 +610,20 @@ encoded by the given c-bytevector. ### Utilities -**libc** +**libc-name** -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. +Name of the C standard library on the current operating system. Supported OS: + +- Windows +- Linux +- Haiku See foreign/c/libc.scm to see which headers are included and what shared libraries are loaded. Example: + (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!") diff --git a/documentation/foreign-c.html b/documentation/foreign-c.html index c1c293e..ffa34c6 100644 --- a/documentation/foreign-c.html +++ b/documentation/foreign-c.html @@ -102,8 +102,15 @@ Schemes - 0.10.0 tables

Required versions:

-
  • STklos > 2.10
  • +
  • STklos > 2.10 +
  • Primitives 1 table

    @@ -159,15 +169,6 @@ Schemes - 0.10.0 - - - - - - - - - @@ -176,7 +177,7 @@ Schemes - 0.10.0 - + @@ -185,7 +186,7 @@ Schemes - 0.10.0 - + @@ -194,7 +195,7 @@ Schemes - 0.10.0 - + @@ -203,7 +204,7 @@ Schemes - 0.10.0 - + @@ -212,7 +213,7 @@ Schemes - 0.10.0 - + @@ -221,7 +222,7 @@ Schemes - 0.10.0 - + @@ -230,7 +231,7 @@ Schemes - 0.10.0 - + diff --git a/documentation/foreign-c.pdf b/documentation/foreign-c.pdf index b4541a3..4aac401 100644 Binary files a/documentation/foreign-c.pdf and b/documentation/foreign-c.pdf differ diff --git a/tests/primitives.scm b/tests/primitives.scm index dc513bf..bc56e4b 100644 --- a/tests/primitives.scm +++ b/tests/primitives.scm @@ -5,10 +5,8 @@ (scheme process-context) (foreign c)) - -(display "libc-name:" ) +(display "libc-name: ") (display libc-name) -(newline) (define-c-library libc '("stdlib.h" "stdio.h" "string.h")
    X
    GambitXXXXXX
    Gauche X X X X
    Guile X X X X
    Kawa X X X X
    Mosh X X X X
    Racket X X X X
    Sagittarius X X X X
    STklos X X X X
    Ypsilon X X