[gambit-list] What is the Scheme notation for **argv

Vok Vojwo ceving at gmail.com
Wed Nov 2 10:18:42 EDT 2011


2011/11/2 Vok Vojwo <ceving at gmail.com>:
>
> I would like to write a c-lambda for gtk_init:
>
> http://developer.gnome.org/gtk/2.24/gtk-General.html#gtk-init
>
> As far as I see I have to specify a Scheme notation identifier for
> each C type. Which would be the correct one for the ***argv argument?
> This is a pointer to mains **argv.

I found the pointer specification. ;-)

(define gtk-init
  (let ((gtk-init (c-lambda ((pointer int #f)
                             (pointer (pointer (pointer char #f) #f) #f))
                            void "gtk_init")))
    (lambda () (gtk-init 0 0))))

But it still does not work.

In C it is possible to avoid the argc and argv arguments:

gtk_init (0, 0);

But the the above Gambit code throws an error:

*** ERROR IN | gtk-hello| -- (Argument 1) Can't convert to C pointer
(| gtk-hello#2| 0 0)

I am wondering why, because the #f tag should suppress type checking.



More information about the Gambit-list mailing list