H
Hugh
Hello,
Apologies if this has already been answered in here and I can't find
it, but can anyone help with this problem?
I hope the example code and comments state clearly enough what is
happening, but if not, please ask me for further information.
Thank in advance for any help.

Hugh
#!/usr/bin/python
# 1. DLL C++ source code
#
# #include <Python.h>
# static PyObject* dummy(PyObject* self, PyObject* args)
# {
# return Py_None;
# }
# static PyMethodDef py_dll_test_methods[] =
# {
# { "dummy", dummy, METH_VARARGS, "dummy" },
# { 0,0,0,0 }
# };
# extern "C" void _declspec(dllexport) initpy_dll_test(void)
# {
# (void) Py_InitModule("py_dll_test", py_dll_test_methods);
# }
#
# 2. Build release DLL using MSVC++ version 6.0, linking with
"python22.lib"
#
# 3. Copy DLL to "c:\python22\python\dll" directory
#
# 4. Python source
import py_dll_test
import time
while 1:
py_dll_test.dummy()
time.sleep(0.01)
# 5. Run python source
# c:\>c:\Python22\python console_test.py
# 6. Program runs for a while, but then crashes after 24 seconds with
# abnormal program termination
# Note. If I reduce the sleep time, the crash happens earlier.
Apologies if this has already been answered in here and I can't find
it, but can anyone help with this problem?
I hope the example code and comments state clearly enough what is
happening, but if not, please ask me for further information.
Thank in advance for any help.
Hugh
#!/usr/bin/python
# 1. DLL C++ source code
#
# #include <Python.h>
# static PyObject* dummy(PyObject* self, PyObject* args)
# {
# return Py_None;
# }
# static PyMethodDef py_dll_test_methods[] =
# {
# { "dummy", dummy, METH_VARARGS, "dummy" },
# { 0,0,0,0 }
# };
# extern "C" void _declspec(dllexport) initpy_dll_test(void)
# {
# (void) Py_InitModule("py_dll_test", py_dll_test_methods);
# }
#
# 2. Build release DLL using MSVC++ version 6.0, linking with
"python22.lib"
#
# 3. Copy DLL to "c:\python22\python\dll" directory
#
# 4. Python source
import py_dll_test
import time
while 1:
py_dll_test.dummy()
time.sleep(0.01)
# 5. Run python source
# c:\>c:\Python22\python console_test.py
# 6. Program runs for a while, but then crashes after 24 seconds with
# abnormal program termination
# Note. If I reduce the sleep time, the crash happens earlier.