Hi,

I'd like to ask for your help regarding the use of SWIG with numpy.

** problem description **
While I can compile successfully the examples provided in ./numpy/doc/swig

I can't compile the first example provided in the Cookbook.

http://www.scipy.org/Cookbook/SWIG_NumPy_examples

"A simple ARGOUT_ARRAY1 example"

I have this error:
ezrange_wrap.c: In function ‘SWIG_AsVal_long’:
ezrange_wrap.c:3227: error: initializer element is not constant

** hypothesis and ugly workaround **
Comparing the examples from ./numpy/doc/swig and from the Cookbook, I
noticed the main difference lies in the fact the first are in C++ while the
latter in plain C.

I "converted" the example from the Coobook to look like a c++ project.
Essentially I renamed the .c file with a .cxx extension and I modified
setup.py accordingly.
This time it compiles successfully and the module is usable in python.

** questions **
1/ What should I do to compile the Cookbook example with a C compiler?

2/ If it appears swig is now only compatible with the C++ compiler, do you
have a practical workaround to propose? (without renaming the C files with a
.cxx extension) ?

** configuration **
debian testing i686
swig version 1.3.40
python-numpy version 1.5.1 (I also tried 1.4.1)
python version 2.6


I hope I explained my problem clearly enough. Tell me if you need more
details.

Regards,

KB
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to