From: William S F. <ws...@fu...> - 2009-07-23 22:26:08
|
Xin Shuai wrote: > In libsequence, there're a few .tcc files which defines templates. I > think I can just handle them as usual templates. That is , First parse > the definition , then instantiate them using defined type. > > Today I tried to use Alignment.tcc. So I revised my interface file: > ... > %include *<*../../Alignment.tcc*>* > ... > %template() Sequence::Alignment::IsAlignment*<*Sequence::Fasta*>*; > .... > > > Everything looks fine until I successfully created the wrapping code and > dynamic library. But when I want to import the dynamic library in > python, error appeared: > ... > ImportError: dlopen(../libsequence/biolib/_libsequence.so, 2): Symbol > not found: > __ZN8Sequence9Alignment7GetDataINS_5FastaEEERSiRSt6vectorIT_SaIS5_EES3_ > Referenced from: > /Users/diavy/Documents/BioLib/biolib/src/mappings/swig/python/libsequence/biolib/_libsequence.so > Expected in: flat namespace > > It seems like my instantiated template code haven't been complied into > my dynamic library. > > Can anyone give me some advice? Assuming the templates include the code bodies in the .tcc files, you need to add in a #include of the .tcc files into your wrappers. Take a look at any of the basic examples shipped with SWIG for details, where they normally #include the header files. Otherwise link to the compiled version of the template code. William |