From: Park SungMin <byulparan_eng@icloud.com>
To: guile-user@gnu.org
Subject: how to access c-array member in c-structure?
Date: Wed, 30 Mar 2016 09:13:00 +0900 [thread overview]
Message-ID: <9FB905A2-E625-4B23-BBB3-18831A9535EC@icloud.com> (raw)
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)
next reply other threads:[~2016-03-30 0:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 0:13 Park SungMin [this message]
2016-03-30 8:03 ` how to access c-array member in c-structure? Taylan Ulrich Bayırlı/Kammer
2016-03-30 8:07 ` tomas
2016-03-30 9:03 ` Taylan Ulrich Bayırlı/Kammer
2016-03-30 16:01 ` Park SungMin
2016-03-30 19:54 ` Taylan Ulrich Bayırlı/Kammer
2016-03-31 3:02 ` Park SungMin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9FB905A2-E625-4B23-BBB3-18831A9535EC@icloud.com \
--to=byulparan_eng@icloud.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).