Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Alex Mohr
On 10/26/2012 1:27 PM, Stefan Seefeld wrote: The entire issue disappears if you move your member function definitions (including the constructor) from varbls.cpp to varbls.h. Alternatively, explicitly instantiate in varbls.cpp. template class _Variable; Again, you might want to google "explic

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Stefan Seefeld
On 10/26/2012 04:15 PM, Paul O. Seidon wrote: > Yes, I have to provide a TYPE to the tempate to enable the compiler to > generate code. Isn't > > typedef _Variable VariableDouble; > > BOOST_PYTHON_MODULE(_varbls) > { > > class_("VariableDouble") > .def( init<>()) > .def( ini

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Paul O. Seidon
Stefan Seefeld wrote: > On 10/26/2012 02:24 PM, Paul O. Seidon wrote: >> Paul O. Seidon wrote: >> >> That doesn't do it either. I can't help but post the compete code here to >> be sure I'm not misunderstood. The lib consists of varbls.cpp and >> varbls.h and the wrapper main.cpp. > >> varbls.cp

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Stefan Seefeld
On 10/26/2012 02:24 PM, Paul O. Seidon wrote: > Paul O. Seidon wrote: > > That doesn't do it either. I can't help but post the compete code here to be > sure I'm not misunderstood. The lib consists of varbls.cpp and varbls.h and > the wrapper main.cpp. > varbls.cpp > == > > #include "va

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Alex Mohr
On 10/26/2012 11:16 AM, Paul O. Seidon wrote: would do that. Should I try dont_care = _Variable(); in main.cpp? Looks a bit strange, but would force the compiler to generate code for sure. You either need to inline the ctor in the header or do an explicit instantiation of _Variable somewhere

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Stefan Seefeld
On 10/26/2012 02:16 PM, Paul O. Seidon wrote: > Stefan Seefeld wrote: > >> On 10/26/2012 01:50 PM, Paul O. Seidon wrote: >>> The ctor is decl'ed in varbls.h as >>> >>> _Variable(); >>> >>> and it's def'ed in varbls.cpp like so: >>> >>> template >>> _Variable::_Variable() >>> : _value( 0) >>> { >>>

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Paul O. Seidon
Paul O. Seidon wrote: > Stefan Seefeld wrote: > >> On 10/26/2012 01:50 PM, Paul O. Seidon wrote: >>> The ctor is decl'ed in varbls.h as >>> >>> _Variable(); >>> >>> and it's def'ed in varbls.cpp like so: >>> >>> template >>> _Variable::_Variable() >>> : _value( 0) >>> { >>> //ctor >>> } >>

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Paul O. Seidon
Stefan Seefeld wrote: > On 10/26/2012 01:50 PM, Paul O. Seidon wrote: >> The ctor is decl'ed in varbls.h as >> >> _Variable(); >> >> and it's def'ed in varbls.cpp like so: >> >> template >> _Variable::_Variable() >> : _value( 0) >> { >> //ctor >> } > > That doesn't work. When the compiler c

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Stefan Seefeld
On 10/26/2012 01:50 PM, Paul O. Seidon wrote: > The ctor is decl'ed in varbls.h as > > _Variable(); > > and it's def'ed in varbls.cpp like so: > > template > _Variable::_Variable() > : _value( 0) > { > //ctor > } That doesn't work. When the compiler compiles varbls.cpp, it doesn't know what

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Paul O. Seidon
Stefan Seefeld wrote: > On 10/26/2012 07:42 AM, Paul O. Seidon wrote: >> Hi all, >> >> right now I'm doing my first stepps in wrapping C++ code by ude of Boost. > > [...] > > Where is the definition of your _Variable template instances ? Your > newly compiled Python module can't find them. The l

Re: [C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Stefan Seefeld
On 10/26/2012 07:42 AM, Paul O. Seidon wrote: > Hi all, > > right now I'm doing my first stepps in wrapping C++ code by ude of Boost. [...] Where is the definition of your _Variable template instances ? Your newly compiled Python module can't find them. The likely cause is that you forgot to link

[C++-sig] [boost.python] Can't import a wrapped template class

2012-10-26 Thread Paul O. Seidon
Hi all, right now I'm doing my first stepps in wrapping C++ code by ude of Boost. So, there's a template class _Variable with ctor, dtor, an inspector TYPE value() const and a mutator void value( const TYPE& value). The boost wrapper looks like this: #include #include using namespace bo