guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ffi for glutInit


From: Aleix Conchillo Flaqué
Subject: Re: ffi for glutInit
Date: Thu, 26 Jul 2012 08:46:49 -0700

On Wed, Jul 25, 2012 at 7:30 PM, Nala Ginrut <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]