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.
And the second problem is, how can I access the original argv? I think the command-line function returns a copy of the argv values.
Afficher les réponses par date
2011/11/2 Vok Vojwo ceving@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.
Hallo,
On Wed, Nov 2, 2011 at 3:18 PM, Vok Vojwo ceving@gmail.com wrote: >
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)
A null pointer in the Gambit-C FFI is #f, not 0.
Cheers,