help-smalltalk
[Top][All Lists]
Advanced

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

[Help-smalltalk] Problems with C call-outs


From: David Forster
Subject: [Help-smalltalk] Problems with C call-outs
Date: Fri, 27 Dec 2002 14:41:42 -0700
User-agent: Mutt/1.3.28i

I've started work on a set of Xlib bindings for GNU Smalltalk in order
to facilitate better integration with bindings for other X-based
libraries (such as, for example, Imlib2).  So far all I have is an AWK
script that auto-generates the defineCFunc: declarations from Xlib.h
and a basic Display object to hold everything.  This generates around
250+ methods for my Display object.

The problem is that GST is loosing track of or mixing up the addresses
for some of the functions.  It looks like it's more likely to set a
functions address to 16r0, but every now and then I think it might be
mixing pointers up (i.e., I'll get an X protocol error for
X_CreatePixmap when I never called XCreatePixmap).

This can be seen by doing:

st> CFunctionDescs inspect!
An instance of Dictionary
  tally: 416
  contents: [
    #CFunction25784->CFunctionDescriptor(XRemoveHost @ 16r5423C5C4)
    #CFunction33360->CFunctionDescriptor(XSetState @ 16r5424AF00)
...
    #CFunction33932->CFunctionDescriptor(XSetWindowBackground @ 16r54231B94)
    #CFunction12401->CFunctionDescriptor(XKillClient @ 16r0)
    #CFunction24039->CFunctionDescriptor(XProcessInternalConnection @ 
16r542505E0)

The set of wrong functions is consistent when run with exact same code
in the same environment (like, say, from EMACS).  But if I change the
code just slightly, like add an extra statement some where, different
functions will get clobbered.  I so far have not seen any segfaults
from any truly corrupt pointers.

I've tried this both on Debian GNU/Linux 3.0 and FreeBSD 4.7.  FreeBSD
doesn't seem to have nearly as much trouble, but I still see a few
CFunctionDescriptor's with an address of 16r0.  

I've attached what I have so far in order to reproduce the bug...  To
run, just fileIn: xtest.st and execute `xTest run!'...It should pop-up
a white window with (perhaps) a black rectangle.

Thanks,
-Dave



reply via email to

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