[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
how to access c-array member in c-structure?
From: |
Park SungMin |
Subject: |
how to access c-array member in c-structure? |
Date: |
Wed, 30 Mar 2016 09:13:00 +0900 |
I read https://www.gnu.org/software/guile/manual/html_node/Foreign-Structs.html
..
follow c struct
struct foo {
int a;
int b[4];
}
then
(let ((foo-type (list int (make-list 4 int))))
(parse-c-struct (make-c-struct foo-type (list 1 (list 1 2 3 4))) foo-type))
is run well.
but,
typedef struct {
int a;
int b;
int c[20000];
} Foo;
Foo make_foo(int a, int b) {
Foo foo = {.a = a, .b = b};
return foo;
}
(let ((c-type (list int int (make-list 20000 int))))
(parse-c-struct
((pointer->procedure
c-type
(dynamic-func "make_foo" libfoo)
(list int int))
4 11)
c-type))
also run well…but seems less effective.(if more bigger size…2000000??)
is it possible pass or return as bytevector or pointer to c-array?
(let ((c-type (list int int ‘*)) ….) is different type….(when i try it, guile
shutdown)
- how to access c-array member in c-structure?,
Park SungMin <=