[Top][All Lists]

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

[Help-smalltalk] (long) DLD help / SDL bindings for GNU Smalltalk

From: Simon Britnell
Subject: [Help-smalltalk] (long) DLD help / SDL bindings for GNU Smalltalk
Date: Fri, 27 Apr 2001 04:09:43 -0700 (PDT)

Hello everyone. I've just spent a couple of days leave
from work learning squeak and gnu smalltalk.  After
some messing about, I've decided on gnu smalltalk as
my present implementation of choice.  I wish to use it
to experiment with writing a computer game.  To do
this, I want to use SDL
I'm in the process of writing/Generating SDL bindings.

I want to know if I'm about to commit a cardinal sin,
drooling braindamage or anything else that's likely to
get me (laughed|shot) at.  Being new to smalltalk in
general and gst specifically, I suspect I'm
overlooking something.

Initially, I was intending to use:
DLD linkFile:
DLD library: getFunc
DLD defineCFunc: as:
and then create a CSDL class with a large number of
!CSDL class defineCFunc: 'foo' ...

This worked well up to the point that I needed to
examine the innards of some struct *s returned by SDL.
 As far as I can see, I need to go back into C to pull
apart the structs.  Given some structure:
typedef struct {
    int bar;
    Baz *baz;
} Foo;

I've generated some C:

int gstFoo_bar( Foo *s ) { return s->bar; }
Baz *gstFoo_baz( Foo *s ) { return s->baz; }

and some smalltalk:

Object subclass: #CFoo ...
!CFoo defineCFunc: 'gstFoo_bar'
    withSelectorArgs: 'bar: struct'
    returning: #int
    args: #( #cObject )
!CFoo defineCFunc: 'gstFoo_baz'
    withSelectorArgs: 'baz: struct'
    returning: #cObject
    args: #( #cObject )

BTW, I note there is some discussion about interface
generators on this list vis-a-vis GTK, but I haven't
seen anything conclusive.  I guess that we'd
eventually want any 'official' generic generator to be
written in gst.  I looked (briefly) at doing something
with the regex example, but ran away screaming when I
saw it was going to be subject to fits of change.

Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices

reply via email to

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