Park SungMin <[email protected]> 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)))
    
    (define make-foo
      (pointer->procedure foo-type
                          (dynamic-func "make_foo" libfoo)
                          (list int int)))
    
    (parse-c-struct (make-foo 4 11) foo-type)
    (parse-c-struct (make-foo 12 5) foo-type)
    (parse-c-struct (make-foo 8 91) foo-type)
    ...

Taylan

Reply via email to