473,395 Members | 1,678 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,395 software developers and data experts.

python c interface problems

I recently made a python module which calls functions from a c program. I used SWIG to generate the wrapper code from an interface file, and compiled the module into a dll which i can import in python and call functions from. While some of the functions are working fine, the others are giving serious errors like:

Python 2.4.3 (#1, May 18 2006, 07:40:45)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import agent
>>> agent.dummy_foo()
agent::dummy_foo called!!
x val is: 25
0
>>> agent.get_agent_property(40,12,"agentclass")
you are in get_agent_property:
40 [main] python 5216 _cygtls::handle_exceptions: Error while dumping state
(probably corrupted stack)
Segmentation fault (core dumped)


As shown above, i have no problem calling a dummy function, but when i call the other function, i get the "corrupted stack" and "segmentation fault" errors. I am running these on Cygwin.

Could anyone help me out with this?
Mar 15 '07 #1
1 1664
bartonc
6,596 Expert 4TB
I recently made a python module which calls functions from a c program. I used SWIG to generate the wrapper code from an interface file, and compiled the module into a dll which i can import in python and call functions from. While some of the functions are working fine, the others are giving serious errors like:

Python 2.4.3 (#1, May 18 2006, 07:40:45)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import agent
>>> agent.dummy_foo()
agent::dummy_foo called!!
x val is: 25
0
>>> agent.get_agent_property(40,12,"agentclass")
you are in get_agent_property:
40 [main] python 5216 _cygtls::handle_exceptions: Error while dumping state
(probably corrupted stack)
Segmentation fault (core dumped)


As shown above, i have no problem calling a dummy function, but when i call the other function, i get the "corrupted stack" and "segmentation fault" errors. I am running these on Cygwin.

Could anyone help me out with this?
If you have done the string interface correctly, then the problem must be in the C part, because the string is the only thing that will allocate memory in the interface.
Mar 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Alan Sheehan | last post by:
Hi, I am considering scripting a large C++ application. In particular I am interested in test driving and end-user scripting the "application layer" in Python and giving it access to a large...
3
by: Kyler Laird | last post by:
I've been using Unison http://www.cis.upenn.edu/~bcpierce/unison/ for awhile and it causes me a lot of grief. I'd love to have a Python version which would be vastly easier to modify. Anyone...
63
by: Davor | last post by:
Is it possible to write purely procedural code in Python, or the OO constructs in both language and supporting libraries have got so embedded that it's impossible to avoid them? Also, is anyone...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
47
by: Kenneth McDonald | last post by:
Is there any emerging consensus on the "best" UI for toolkit. Tk never quite made it but from what I can see, both qt and wxWin are both doing fairly well in general. I'm already aware of the...
34
by: Victor Kryukov | last post by:
Hello list, our team is going to rewrite our existing web-site, which has a lot of dynamic content and was quickly prototyped some time ago. Today, as we get better idea of what we need, we're...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.