473,323 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

SWIG - python.exe crash

When I try to print an object in Python, python.exe crashes. Below
are my files.

defs.h
------------------------------------------------------------------------------------------------------
typedef unsigned long MY_DIGIT;
myapp.c
------------------------------------------------------------------------------------------------------
void MakeDigits(MY_DIGIT digits[]) {
....
}

char* GetString(char *inMessage, MY_DIGIT *digit) {
char *results;
...
...
return results;
}
MyApp.i
------------------------------------------------------------------------------------------------------
%module MyApp
%{
#include "math.h"
%}

extern void MakeDigits(MY_DIGIT digits[]);
extern char* GetString(char *inMessage, MY_DIGIT *digit);

/* allows for the creation of a MY_DIGIT array */
%inline %{
MY_DIGIT *my_digit_array(int size) {
return (MY_DIGIT *) malloc(size * sizeof(int));
}
%}
....I have two questions.

1) One, I call MakeDigits which should populate the "digits" array with
some values. It seems the first time I try it the digits array is
populated. Then if I try to re-use the digits array i get some garbage
output. But if I recall MakeDigits...I can then re-use the digits
array over and over without anymore problems? Any idea?
here is how I was trying it...
digits = my_digit_array(10)
MakeDigits(digits)

2) When I try to print the "my_digit_array" object, python.exe
crashes...below is the code I use to cause this problem: (within
python)
digits = my_digit_array(10)
print digits

I am using Python 2.4.1, Swig 1.3.25 on Win XP Pro.

I tried sending a message on the SWIG mailing list...but so far it
hasn't shown up on the list...I've sent it three times now. I'll keep
trying.

Oct 4 '05 #1
0 1031

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jon Moldover | last post by:
Hi, I'm using Python in my win32 app by linking to the python23.dll. I'm trying to expose some c++ code in my app to Python so I can make application calls from Python scripts (according to the...
0
by: Andrew Collier | last post by:
hello, i am not sure whether this problem relates to swig, python or my c++ compiler. +please forgive me if this is inappropriately posted but i am sure that someone +on this list must have some...
3
by: matteo | last post by:
Hi, I've got a problem with SWIG and Python2.2.I've installed the SWIG1.3.21 releaseunder QNX6.2 platform .I tried to make the exemple example.c (in the directory ../Swig/Exemple/python/simple) /*...
0
by: Helmut Zeisel | last post by:
I want to build a static extension of Python using SWIG and VC++ 6.0 as described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc. My file is testerl.i: ========================= %module...
1
by: Java and Swing | last post by:
I am trying to wrap some C code I have. Currently I have something like... defs.h ----------- typedef unsigned long MY_DIGIT; myapp.c ------------- void MakeDigits(MY_DIGIT digits) {
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
10
by: Bart Ogryczak | last post by:
Hi, I´m looking for some benchmarks comparing SWIG generated modules with modules made directly with C/Python API. Just how much overhead does SWIG give? Doing profile of my code I see, that it...
1
by: Uberman | last post by:
I have a bit of a odd arrangement here with SWIG, Python, Embedded Python and C++ classes exported into Python. Here's the plot: I have a class defined in a C++ DLL library. I am wrapping this...
0
by: Basha J P M | last post by:
I am beginner in python. I am working through the tutorial examples from http://www.swig.org/ and have run into some problems. I took the following command instructions from the tutorial on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.