No response yet. The SWIG test works fine in Linux no problems.
However, I still have the problem in Cygwin.
Also, not sure if related but I do have a win32 Python 2.4.3 and
Cygwin Python 2.4.1. Not sure if there are any conflicts. Any advice
in making these two co-exist?
The only C/C++ compiler I have presently is Cygwin gcc.
Thanks in advance:
Michael Yanowitz
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf
Of Michael Yanowitz
Sent: Tuesday, June 20, 2006 3:39 PM
To: python-list@python.org
Subject: SWIG problems with gcc and Cygwin?
Hello:
I am just trying out SWIG, but quickly ran into problems.
Using Cygwin gcc, I tried the following:
1) Created example.c (as given on http://www.swig.org/tutorial.html )
/* 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);
}
2) Create interface file, example.i
/* example.i */
%module example
%{
/* Put header files here or function declarations like below */
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
%}
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
3)ran in cygwin: swig -i python example.i
4)Attempted to run on cygwin: ld -shared example.o example_wrap.o -o
_example.so
But got back many errors:
example.o:example.c:(.text+0x55): undefined reference to `time'
example.o:example.c:(.text+0x60): undefined reference to `ctime'
example_wrap.o:example_wrap.c:(.text+0x9c): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x12c): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x1dd): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x494): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x748): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x779): undefined reference to `strcpy'
example_wrap.o:example_wrap.c:(.text+0x7a5): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x805): undefined reference to `strlen'
example_wrap.o:example_wrap.c:(.text+0x877): undefined reference to
`strncpy'
example_wrap.o:example_wrap.c:(.text+0x8ab): undefined reference to `strcmp'
example_wrap.o:example_wrap.c:(.text+0x8c9): undefined reference to `memset'
example_wrap.o:example_wrap.c:(.text+0x948): undefined reference to `fputs'
example_wrap.o:example_wrap.c:(.text+0x95d): undefined reference to `fputs'
example_wrap.o:example_wrap.c:(.text+0x970): undefined reference to `fputs'
example_wrap.o:example_wrap.c:(.text+0x9db): undefined reference to
`PyString_Fr
omFormat'
example_wrap.o:example_wrap.c:(.text+0xa3a): undefined reference to
`PyString_Fr
omString'
example_wrap.o:example_wrap.c:(.text+0xa68): undefined reference to
`PyLong_From
VoidPtr'
example_wrap.o:example_wrap.c:(.text+0xa83): undefined reference to
`PyTuple_New
etc...
Any idea what I am doing wrong or omitted?
Of course when I then try to go into python and
import example, I get:
import example
Traceback (most recent call last):
File stdin, line 1, in ?
File example.py, line 5, in ?
import _example
ImportError: No module named _example
Thanks in advance:
Michael Yanowitz
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list