ctypes error on exit of win32 application

R

Rubic

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:
'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)
 
G

Gabriel Genellina

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:
'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."

Maybe process_record expects some minimum buffer size? The cpp example
uses char record[100], but you are allocating only a few bytes with the
string "My Record"
 
R

Rubic

Maybe process_record expects some minimum buffer size? The cpp example
uses char record[100], but you are allocating only a few bytes with the
string "My Record"

No, I've already tried padding record out to the full size. But thank
you for the suggestion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top