Hi everybody!

I am going to write the XCB binding for GNU Smalltalk and now I'm
playng with C call-outs.

I've got an issue in the case when C function returns a structure
itself (not a pointer).

There are two files in attachments:
 * rootwin.c - the C code that aquires current screen and prints the
root window's ID
 * xcbroot.st - the Smalltalk port of rootwin.c

`--> ./rootwin
root window 163

`--> gst -f xcbroot.st
xcbroot.st:56: Aborted
(ip 10)CUInt(CScalar)>>#value
(ip 6)UndefinedObject>>#executeStatements
(ip 0)<bottom>
zsh: abort      gst -f xcbroot.st

I assume that I missunderstood something about pointer-to-structure
conversions, however I wrote this code according to GST manual (C data
types, etc). I think I did something wrong.

Could anybody please help me with this problem?
#include <stdio.h>
#include <unistd.h>      /* pause() */
#include <xcb/xcb.h>

int
main ()
{
    /* Open the connection to the X server */
    xcb_connection_t *connection = xcb_connect (NULL, NULL);

    /* Get the first screen */
    const xcb_setup_t      *setup  = xcb_get_setup (connection);
    xcb_screen_iterator_t   iter   = xcb_setup_roots_iterator (setup);
    xcb_screen_t           *screen = iter.data;

    printf ("root window id %d\n", screen->root);

    xcb_disconnect (connection);

    return 0;
}

Attachment: xcbroot.st
Description: Binary data

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to