Skip to content

Commit

Permalink
Merge branch 'doc-ffi' of https://github.com/jpellegrini/STklos into …
Browse files Browse the repository at this point in the history
…jpellegrini-doc-ffi
  • Loading branch information
egallesio committed Aug 23, 2024
2 parents 19cfff9 + f6d883c commit dc6f41a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions doc/refman/ffi.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,22 @@ the FFI better!):
=> "ring"
```
In order to pass a `NULL` pointer to an external C function, the
`#void` Scheme value can be used.
As an example, the second argument to the `strtol` function can be
`NULL`:
```scheme
(define-external strtol(:string :pointer :int)
:return-type :long)
```
```scheme
(strtol "1001" #void 10) => 1001
(strtol "1001" #void 2) => 9
```
Functions on C pointers are described in the next section.
### C pointers
Expand All @@ -178,5 +194,3 @@ errors, crashes...
{{insertdoc 'cpointer->string}}
{{insertdoc 'allocate-bytes}}
{{insertdoc 'free-bytes}}

0 comments on commit dc6f41a

Please sign in to comment.