|
From: | Stephan Lukits |
Subject: | sx:make-draw-area (was Re: [Chicken-users] what are pointers (in scheme)) |
Date: | Thu, 29 Nov 2007 10:15:02 +0100 |
User-agent: | Thunderbird 2.0.0.9 (X11/20071031) |
felix winkelmann schrieb:
On Nov 29, 2007 6:01 AM, Stephan Lukits <address@hidden> wrote:Hi, could anyone please direct my to the right documentation for using eggs which implement c-libraries? I have no idear how I should call function like (sx:open-display INT (POINTER (POINTER CHAR))) and how I get the data which will be bound to the (two-dimensional I guess) "pointer"?Hi! Some APIs are generated semi-automatically, for example using easyffi. The C function behind sx:open-display expects an argc/argv argument pair, which is not directly representable in Scheme, but (and this is exclusively for this particular case) "(argc+argv)" will return two values that can be passed to the mentioned function. In case of the sx egg: you don't need to call sx:open-display, this is done automatically.
Yes, thats what I red in the libsx docs, but modifying your libsx example slightly through replacing the selection-list by a draw-area leads to an error if the line which defines the draw-area comes before the definition of the button. e.g.: (require-extension sx posix (srfi 1)) (define (button) (sx:close-window)) (define (redraw width height) (print "da-size: " width "x" height) ) (define b (sx:make-button "Update" button)) (define da (sx:make-draw-area 300 200 redraw)) (sx:set-widget-pos da sx:place-under b) (sx:main-loop) works fine, but (require-extension sx posix (srfi 1)) (define (button) (sx:close-window)) (define (redraw width height) (print "da-size: " width "x" height) ) (define da (sx:make-draw-area 300 200 redraw)) (define b (sx:make-button "Update" button)) (sx:set-widget-pos da sx:place-under b) (sx:main-loop) leads to a "Speicherzugriffsfehler", thus I thought I call "sx:open-display" first maybe it's working then but using (sx:open-display 0 (argc+argv)) still raises "Error: bad argument type - not a pointer: 1" llap Stephan
[Prev in Thread] | Current Thread | [Next in Thread] |