Add section describing cfn function
This commit is contained in:
parent
ba7b5bc4aa
commit
739092ade6
1 changed files with 8 additions and 0 deletions
|
|
@ -43,6 +43,14 @@ native function reference, followed by an optional docstring and attribute map,
|
||||||
then the C function identifier, including the name of the native symbol, a
|
then the C function identifier, including the name of the native symbol, a
|
||||||
vector of argument types, and the return type.
|
vector of argument types, and the return type.
|
||||||
|
|
||||||
|
If you wish to use a native function as an anonymous function, it can be done
|
||||||
|
with the `cfn` function.
|
||||||
|
|
||||||
|
```clojure
|
||||||
|
((ffi/cfn "strlen" [::ffi/c-string] ::ffi/long) "hello")
|
||||||
|
;; => 5
|
||||||
|
```
|
||||||
|
|
||||||
### Primitive Types
|
### Primitive Types
|
||||||
Coffi defines a basic set of primitive types:
|
Coffi defines a basic set of primitive types:
|
||||||
- byte
|
- byte
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue