Issue1706381
Created on 2007-04-24 08:49 by epcylon, last changed 2007-04-24 15:27 by georg.brandl.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
swig_target.patch
|
epcylon,
2007-04-24 08:49
|
Patch to check extension aswell when determining target_ext |
|
|
|
msg31872 - (view) |
Author: Morten Lied Johansen (epcylon) |
Date: 2007-04-24 08:49 |
|
I guess this is an undocumented feature, so maybe I shouldn't complain (but the patch to the docs has been in the patch tracker waiting to go in since 2004 it seems).
Default for SWIG is to produce C code, in a file called xxx_wrap.c. If you want C++, you need to specify the -c++ option (in which case you would normally want a file called xxx_wrap.cpp).
You can specify this option in two ways, either on the commandline, like so:
python setup.py build_ext --swig-opts="-c++"
or as an option to your Extention module in setup.py like so:
...
ext_modules = [Extension("_xxx", ["xxx.i","xxx.cpp"], swig_opts=["-c++"])]
...
The latter is much preferable, as it doesn't mean you have to remember to specify the option on the commandline all the time.
When specifying on the commandline, the -c++ is taken into account for creating the name of the output, and you get a file called xxx_wrap.cpp. Specifying the option in setup.py however, is not taken into account, and you get a file called xxx_wrap.c, which contains C++ code and generally doesn't compile (since the compiler assumes it's pure C).
I've attached a simple patch that seems to solve the problem.
|
|
msg31873 - (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2007-04-24 15:27 |
|
Thanks for the report, fixed in rev. 54941, 54942 (2.5).
|
|
| Date |
User |
Action |
Args |
| 2007-04-24 08:49:02 | epcylon | create | |
|