On Jul 6, 2006, at 7:58 PM, Siddartha Krishnan wrote:
Hi, I'm new to using SWIG for python. I am having several problems creating a C++ extension module for python. I am using OS X 10.4 with python 2.4 and SWIG 1.3.29 (using darwinports). I can use SWIG and distutils in order to make a C extension module for python, however, I cannot do so for a C++ extension module - I get an import error: mie-15-203:~/swig/class_test siddarthakrishnan$ python mymod.py Traceback (most recent call last): File "mymod.py", line 5, in ? import _mymod ImportError: Failure linking new module: /Users/siddarthakrishnan/ SWIG/class_test/_mymod.so: Symbol not found: __ZN9SomeClassC1Eii Referenced from: /Users/siddarthakrishnan/SWIG/class_test/_mymod.so Expected in: dynamic lookup The setup.py file is as follows: # setup.py from distutils.core import setup, Extension setup (name = "_mymod", version = "1.0", maintainer = "Your Name", maintainer_email = "[EMAIL PROTECTED]", description = "Sample Python C++ Extension", ext_modules = [Extension('_mymod', sources=['mymod_wrap.cxx'])]) Does anyone know how to create a setup.py file that works with c++ extension modules?
Are you linking with all libraries that are needed for the extension? Your module seems to be missing 'SomeClass::SomeClass(int, int)'.
If you do the link step that setup.py generates manually, but add '- framework Python' and remove '-undefined surpress' you should get a list of all symbols that aren't present in the extension. However, don't build the final version of the extension like that.
Ronald
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig