A few SWIG/Python questions
d_k2004SPAMMENOT at hotmail.com
Sun Mar 6 20:45:11 CET 2005
I'm using SWIG to generate glue code for my embedded/extended python app.
There are a couple of very frustrating issues that I would like to see if
anyone else has solutions for:
- Once I have created and initialized a module with SWIG I can call it by
executing a python file with no problems. However I would like to be able to
type in a single-line python function and have it execute from my module.
One line cannot contain both "import _mypackage" and
"_mypackage.DoFunction("hello")" (and even if it could it would be
cumbersome). I cannot find a way to manually import (in code) the methods
from my package prior to executing the single-line instruction. I can get
the dictionary but that doesn't give me the methods. How do I do this?
- For some reason whatever name I give the module (via %module name) ends up
with an underscore at its beginning - e.g., _name. I don't know why this is,
and it was the source of some serious hair-pulling. Is there a way to turn
this off (without recompiling the swig executable)?
- SWIG in general generates a TON of code for the glue module. Is there a
way to reduce this?
- SWIG wraps everything with extern "C", which is unnecessary for my code
and requires me to decorate functions unnecessarily. Is there a way to turn
More information about the Python-list