On Wed, Jul 25, 2012 at 7:30 PM, Nala Ginrut <nalagin...@gmail.com> wrote:
> hi Aleix!
> For our FFI system:
> char** <==> '* <==> (quote *)
>
> I'm not sure I understand your question correctly.
> I assume that you want to know what's the presentation of char** for
> dynamic-func.
>

Let me try again: how do I create a C array of strings in scheme?

I took define-foreign from guile-gdbm (thanks Ian!):

(define libglut (dynamic-link "libglut"))

(define-syntax-rule (define-foreign name ret string-name args)
  (define name
    (pointer->procedure ret (dynamic-func string-name libglut) args)))

Then, for glutInit I already use '* as you suggest:

(define-foreign %glutInit void "glutInit" '(list '* '*))

Finally, I implement (glutInit):

(define (glutInit)
  (%glutInit %null-pointer %null-pointer))

Which is obviously not working right now. I need to know how to create
char** to be given to %glutInit. I think I know it for the first
argument, which is  a int* (I'll use a struct with an int and then
make-c-struct and then get the pointer).

But, how to create char**?

I'll probably go into this again in a couple of days, I feel like a
truck has ran over me today.

Best,

Aleix

Reply via email to