[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to access c-array member in c-structure?
From: |
Taylan Ulrich Bayırlı/Kammer |
Subject: |
Re: how to access c-array member in c-structure? |
Date: |
Wed, 30 Mar 2016 11:03:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
<address@hidden> writes:
> On Wed, Mar 30, 2016 at 10:03:28AM +0200, Taylan Ulrich Bayırlı/Kammer wrote:
>> Park SungMin <address@hidden> writes:
>>
>> > (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??)
>>
>> You could create the type object once at program startup and use it
>> many times.
>>
>> (define foo-type
>> (list int int (make-list 2000000 int)))
>
> If I understood Park SungMin right, the problem is rather with the
> representation of a huge array as a list?
Oh I see.
For me, the following works:
(define type (list int (make-list 10 int)))
(define struct (make-c-struct type (list 42 (make-list 10 42))))
(parse-c-struct struct (list int '*))
=> (1 #<pointer 0x200000002>)
Is it different when the struct really comes from the C library?
Taylan