RE: Callback problem
kbochert at copper.net wrote:
>
> >From: Andy Serpa <renegade at earthling.net>
> >To: EUforum <EUforum at topica.com>
> >Date: 10/11/02 10:29:11 PM
> >Subject: RE: Wrapping C - Callback troubles
>
>
> Bernie Ryan wrote:
> >
> > Andy Serpa wrote:
> > > Here's another problem. I'm making the Berkeley DB wrapper which
> allows
> > > for certain callback functions to be used. One particular one
> I'm
> > > trying to set up is supposed to be a void function. The callback
> works
> > > (my function is called), but when it returns a value (any value)
> it
> > > crashes. (Callback functions are required to return something.)
>
> >But that's not the problem. Setting the callback function is no
> >problem, and my Euphoria function is being called with the correct
> >args.
> >The problem is when my function exits (returns a value) the whole
> >thing
> >crashes with an exception. I was just wondering is that because it
> >is a
> >supposed to be void function? (It seems like I should be able to
> >return
> >anything in that case, but maybe it wants me to return nothing?)
> >Anybody know anything about that?
>
> This sounds like the cdecl-stdcall problem. Many packages that come
> from the unix world expect the callback function to be cdecl rather
> than the windows standard stdcall. If the callback is of the wrong
> variety, the stack gets messed up.
>
> I modified Bach to accept cdecl callbacks -- under Euphoria I think
> the easiest option is to modify the calling convention in the source
> and re-compile the package.
>
> There probably is a way to fix it by poking assembly.
>
See the "Matt Lewis Help!" post -- I'm doing all this in cdecl now.
Still doesn't work on the void function and then there is also that odd
thing with the extra parameter in the other function.
I don't know a thing about ASM so I couldn't possibly tell if maybe the
fptr.e stuff isn't quite right -- hopefully Matt or someone else can. I
am at the limits of my knowledge...
|
Not Categorized, Please Help
|
|