Going through the tutorial on
http://swig.org, I created the example files
(pasted below). After generating the _wrap file, I tried compiling (using
mingw32) and received a lot of undefined reference compiler errors:
...\build\temp.win32-2.5\Release\example_wrap.o:example_wrap.c:(.text+0 x670f):
undefined reference to `_imp__PyExc_MemoryError'
there are many other similar errors all prefaced with _imp__Py, so I am
assuming there is a linker error with the python libraries. I have adjusted
my PATH variable to include all the python directories (libs/dlls), so I am
unclear what else I can try. Any suggestions?
FILES FROM TUTORIAL:
//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(<ime);
return ctime(<ime);
}
//************************************************** *************
//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();
//************************************************** *************
//setup.py
from distutils.core import setup, Extension
setup(name='example',
version = '1.0',
ext_modules=[
Extension('example', ['example.c', 'example.i'])
])
//************************************************** *************
--
View this message in context:
http://www.nabble.com/SWIG---C-Exten...p14373972.html
Sent from the Python - python-list mailing list archive at Nabble.com.