ctypes error on exit of win32 application

Rubic rubic88 at gmail.com
Wed Jan 31 17:04:13 EST 2007


I'm attempting to use ctypes on a DLL with the following
signature:

__declspec(dllimport) void process_record(char *, char *);

An example .cpp file has code like this:

   int main(int argc, char **argv)
   {
      char record[100];
      char code[6];
        ...
      process_record(code, record);

When I invoke it under Python everything fine
while the interpreter is running:

   >>> from ctypes import *
   >>> record = create_string_buffer("My Record")
   >>> code = create_string_buffer('\000' * 6)
   >>> cdll.grouper.process_recode(code, record)
   >>> print code.value
   '9999'

But when the interpreter exits, either interactively
or from a script, the following Program Error popup
gets displayed:

  "python.exe has generated errors and will be closed
   by Windows.  You will need to restart the program."

What can I do to prevent this error?
(Environment: Win2000, Python 2.5)
--
Jeff Bauer
Rubicon, Inc.




More information about the Python-list mailing list