473,395 Members | 1,763 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.

Swig-Python problems

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)
/* File : example.c */

#include <time.h>
double My_variable = 3.0;

int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}

int my_mod(int x, int y) {
return (x%y);
}

char *get_time()
{
time_t ltime;
time(&ltime);
return ctime(&ltime);
}.
After the commans:

swig -python example.i
gcc -c example.c example_wrap.c -I/usr/local/python2.2
ld -shared example.o example_wrap.o -o _example.so

I use Python module as follows
import example


and I've got the message: "Memory falut (core dumped)"
What can I do??
Jul 18 '05 #1
3 1903
In article <cd**************************@posting.google.com >, matteo wrote:
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)
/* File : example.c */

#include <time.h>
double My_variable = 3.0;

int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}

int my_mod(int x, int y) {
return (x%y);
}

char *get_time()
{
time_t ltime;
time(&ltime);
return ctime(&ltime);
}.
After the commans:

swig -python example.i
gcc -c example.c example_wrap.c -I/usr/local/python2.2
ld -shared example.o example_wrap.o -o _example.so

I use Python module as follows
import example


and I've got the message: "Memory falut (core dumped)"
What can I do??


I've found on Linux that it's easy to run the entire Python interpreter
under a debugger. I'm not familiar with the tools on QNX, but I would
add "-g" to the gcc line (to add debugging symbols), and then run "gdb
python", so that when the program crashes you can see exactly where.

(If you're not familiar with gdb, type "run" at the first prompt, and
then use the interpreter as normal, and when the crash happens and you
get back to the gdb prompt, type "bt" to get a backtrace. This should
be all you need to get started.)

Joe
Jul 18 '05 #2
m.*******@itia.cnr.it (matteo) wrote in message news:<cd**************************@posting.google. com>...
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)
/* File : example.c */

#include <time.h>
double My_variable = 3.0;

int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}

int my_mod(int x, int y) {
return (x%y);
}

char *get_time()
{
time_t ltime;
time(&ltime);
return ctime(&ltime);
}.
After the commans:

swig -python example.i
gcc -c example.c example_wrap.c -I/usr/local/python2.2
At first ... please use qcc and not gcc.

qcc -c -fPIC example.c example_wrap.c -I/usr/local/python2.2

should work ...
ld -shared example.o example_wrap.o -o _example.so

I use Python module as follows
>>> import example


and I've got the message: "Memory falut (core dumped)"
What can I do??


... use Pyrex :)

Armin Steinhoff
Jul 18 '05 #3
matteo wrote:
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)
/* File : example.c */

#include <time.h>
double My_variable = 3.0;

int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}

int my_mod(int x, int y) {
return (x%y);
}

char *get_time()
{
time_t ltime;
time(&ltime);
return ctime(&ltime);
}.
After the commans:

swig -python example.i
gcc -c example.c example_wrap.c -I/usr/local/python2.2
ld -shared example.o example_wrap.o -o _example.so

I use Python module as follows
>>> import example


and I've got the message: "Memory falut (core dumped)"
What can I do??


What does your interface space file (examplei.i) contain?

Jul 18 '05 #4

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

Similar topics

2
by: Matt Whelan | last post by:
Supposedly, recent versions of SWIG can be made to work with MS VC++'s non-standard integer data types. According to a recent SWIG ChangeLog entry: %apply long long { __int64 }; should make...
3
by: Kevin Dahlhausen | last post by:
Could anyone post a simple setup.py script that uses a SWIG interface to C++ code and the mingw compiler? I followed some online samples, and am using the setup.cfg file to specify swig-c++=1....
19
by: Thomas Heller | last post by:
ctypes 0.9.2 released - Oct 28, 2004 ==================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call...
1
by: Philip Smith | last post by:
Does anyone use SWIG????? I'm having trouble patching it to allow me to compile wrappers in Borland C++ Builder because Borland will insist on adding underscores to symbols. Turn this off and it...
0
by: peter.o.mueller | last post by:
Hi together, i have a Windows DLL in C that is internally multithreaded and provides a callback function to signal specific events. As I understood one can use "normal" C-code with swig. Is it...
6
by: None | last post by:
Hi, I was trying to use SWIG to expose some C++ functions to perl. But, I ran into some issues here. I don't know why, but I see that a macro in SWIG replaces "NORMAL" with "PL_op->op_next"... ...
0
by: Jazi | last post by:
I would appreciate if someone can help me dealing with wrapping java around c++ using SWIG. I have wrapped simple classes without any problem but I had some difficulties getting a vector function...
2
by: piyushtiwari | last post by:
I have to call a C++ function in php. I tried it using swig. I wrote the interface file example.i to call the functions from example.cxx in php. To build a PHP extension, I run swig using the -php...
1
by: jiangfan | last post by:
Dear All, I am new to SWIG, and I tried to search the SWIG mailinglist for my specific question, but I did not find it. And for a simple one c++ file, I can handle it successfully. Now I have...
3
by: Anish Chapagain | last post by:
Hi.. I'm new to SWIG and need to create Wrapper for C code, so, I have installed the SWIG already but doesnot know how to run it for generating Interface file... My C code is in message.c so what...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.