|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Need more header files with 1.3.40 than 1.3.36I've pasted two small .i files at the end of this message and also
attached them. They use inheritance and boost::shared_ptr If you run swig -python -c++ moduleLib.i with swig 1.3.36 the wrapper contains no reference to LogFormatter, whereas with swig 1.3.40 it does: static void *_p_boost__shared_ptrT_BriefFormatter_tTo_p_boost__shared_ptrT_LogFormatter_t (void *x, int *newmemory) { *newmemory = SWIG_CAST_NEW_MEMORY; return (void *) new boost::shared_ptr< LogFormatter >(* (boost::shared_ptr< BriefFormatter > *)x); } Note that the LogFormatter class is only referenced via an %import statement, not an %include. The result is that with 1.3.40 I need to provide the C++ compiler with a declaration of LogFormatter to compile the swig wrapper, while with 1.3.36 I did not. I don't think that moduleLib needs to know about the class definition; a simple forward reference should suffice and swig could probably generate it. R ----------------- moduleLib.i ---- // -*- c++ -*- %module moduleLib %{ namespace boost { template<typename T> struct shared_ptr { template<typename TT> shared_ptr(TT&) {} }; } #if 0 class LogFormatter; class BriefFormatter; #endif %} %import "includedModuleLib.i" ------------------- includedModuleLib.i --- // -*- c++ -*- %module includedModuleLib %include "boost_shared_ptr.i" SWIG_SHARED_PTR(LogFormatter, LogFormatter) SWIG_SHARED_PTR_DERIVED(BriefFormatter, LogFormatter, BriefFormatter) class LogFormatter { }; class BriefFormatter : public LogFormatter { }; ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Need more header files with 1.3.40 than 1.3.36Robert Lupton the Good wrote:
> I've pasted two small .i files at the end of this message and also > attached them. > They use inheritance and boost::shared_ptr > > If you run > swig -python -c++ moduleLib.i > > with swig 1.3.36 the wrapper contains no reference to LogFormatter, > whereas with swig 1.3.40 it does: > > static void > *_p_boost__shared_ptrT_BriefFormatter_tTo_p_boost__shared_ptrT_LogFormatter_t(void > > *x, int *newmemory) { > *newmemory = SWIG_CAST_NEW_MEMORY; > return (void *) new boost::shared_ptr< LogFormatter > >(*(boost::shared_ptr< BriefFormatter > *)x); > } > 1.3.36 and 1.3.40. So both versions need you to provide the forward class declarations. Can you check again and if you are getting something different, please post with suitable modifications to your .i file. William ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
| Free embeddable forum powered by Nabble | Forum Help |