Thanks to your inspiration, I've already solve the problem.The solution is
just to complie another source file that provide all explicit instantiation
declaration for type Sequence::Fasta
On Thu, Jul 23, 2009 at 6:25 PM, William S Fulton
<wsf@...:
> 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
>
>
--
Xin Shuai (David)
PhD of Complex System in School of Informatics
Indiana University Bloomington
812-606-8019
|