[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can Dynamic FFI in Guile handle pass by value struct?
From: |
Zhu Zihao |
Subject: |
Can Dynamic FFI in Guile handle pass by value struct? |
Date: |
Sat, 06 Feb 2021 22:10:14 +0800 |
User-agent: |
mu4e 1.4.14; emacs 27.1 |
Hi, Guile users!
I'm working on a Guile binding to tree-sitter, an incremental parsing
library. Consider we have something like(actually taken from
tree-sitter's header file)
```
typedef struct {
uint32_t context[4];
const void *id;
const TSTree *tree;
} TSNode;
uint32_t ts_node_end_byte(TSNode);
```
I'd like to write binding like
```
(pointer->procedure uint32 (dynamic-func "ts_node_end_byte" %libtree-sitter)
`((,uint32 * *)))
```
As the function defined in header, we need to pass a TSNode struct by
value to ts_node_end_type. But I'm not sure how to do it in Dynamic FFI.
There's make-c-struct in (system foreign), but it'll return a pointer to
the struct.
I check the doc but can't find something useful, Can guile Dynamic FFI
pass a C struct by value or we must do it in static FFI?
--
Retrieve my PGP public key:
gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F
Zihao
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Can Dynamic FFI in Guile handle pass by value struct?,
Zhu Zihao <=