// _crash.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #ifdef _MANAGED #pragma managed(push, off) #endif #include "python.h" #include "stackless_api.h" PyChannelObject *channel = 0; PyObject *sleep(PyObject *self) { PyObject *obj = PyChannel_Receive(channel); return obj; } PyObject *finish(PyObject *self) { Py_XDECREF(channel); Py_RETURN_NONE; } PyObject *Remove(PyObject *self) { return PyStackless_Schedule(Py_None, 1); } static PyMethodDef crash_methods[] = { {"sleep", (PyCFunction)sleep, METH_NOARGS, ""}, {"finish", (PyCFunction)finish, METH_NOARGS, ""}, {"remove", (PyCFunction)Remove, METH_NOARGS, ""}, 0}; PyMODINIT_FUNC init_crash(void) { PyObject *m = Py_InitModule3("_crash", crash_methods, ""); if (m == NULL) return; channel = PyChannel_New(0); } #ifdef _MANAGED #pragma managed(pop) #endif