[gambit-list] crash on callback from WMI event

Timothy Ritchey tritchey at paragent.com
Fri Jun 16 19:55:10 EDT 2006


I am writing a simple test application that calls out to a custom dll to 
interface with Windows WMI. I am currently trying to get callbacks 
working for WMI Events. I have the following defines for creating an alert:

(define create-alert (c-lambda ((function (wbem-object) int)) void 
"WMICreateAlert"))
(c-define (wmi-alert-callback alert) ("WBEMOBJ") int "wmi_alert_callback" ""
   (+ 1 2))

For testing I have the callback return an integer that I printf() in the 
dll. I then call:

(create-alert wmi-alert-callback)
(read-char)

to create the alert, and wait around for something to happen. When the 
alert is triggered, everything works, and I get back 3 as expected from 
the scheme callback. However, if I put anything more complex in the body 
of wmi-alert-callback (for example (write 3), or (length alert)) The 
application crashes. The debugger is showing that I am not crashing in 
the callback thread, but rather the main thread at line 3965 in 
_kernel.c (I have not yet figured out what the actual function name is):

#undef ___ARG1
    ___SET_R0(___LBL(12))
    ___JUMPGENNOTSAFE(___SET_NARGS(0),___FIX(0L))
___DEF_SLBL(12,___L12__23__23_kernel_2d_handlers)
#define ___ARG1 ___R1
{ ___SCMOBJ ___RESULT;

     ...
     ra1 = ___FP_STK(fp,-___FRAME_STACK_RA); // **** here ****
     ...

fp is reading as 0x00000000 in the debugger. I seems that I am having a 
problem getting the callback thread to play nicely with the main thread 
in Gambit. I am out of my element here, so any advice would be 
appreciated. Is there something I need to do special to get the main 
Gambit thread to work with callbacks from the Windows subsystem?

Cheers,
Tim




More information about the Gambit-list mailing list