Adventures in SWIG and Boost::Python
Posted Tue, 11 Mar 2008
I ran into problem after problem with SWIG, all likely becuase I chose to write c++grok with templates. After failing on that repeatedly, I decided to try out Boost::Python. Also failure. I wasn't able to find docs explaining how to use boost::python without Boost's retarded bjam build system! Fine, so I try to use bjam. After more repeated failing of simply trying to get a hello world example working with bjam, I think I'm giving up for tonight.
Here's a request: Don't make me use your retarded build system.
I fully admit I haven't spent half a lifetime pouring over the Boost::Python documentation, but should I really have to learn an entirely new make(1)-like system just to compile things? With SWIG, atleast the errors were readable and I was able to get things to compile without issue - I just couldn't figure out quickly how to expose the few templated classes c++grok has.
I'm closer to a working python module with SWIG, but the Boost::Python syntax is quite nice and is in pure C++ from what I can tell.
Ugh! Maybe I'll have better luck next time.
I found template instantiation in SWIG:
%template(SGrokRegex) GrokRegex<sregex>; %template(SGrokMatch) GrokMatch<sregex>; ...But compiling this breaks because mark_tag in xpressive seems to lack a default constructor, and the swig-generated code wants to use it?
grok_wrap.cpp:3987: error: no matching function for call to 'boost::xpressive::detail::mark_tag::mark_tag()' /usr/include/boost/xpressive/regex_primitives.hpp:41: note: candidates are: boost::xpressive::detail::mark_tag::mark_tag(int) /usr/include/boost/xpressive/regex_primitives.hpp:40: note: boost::xpressive::detail::mark_tag::mark_tag(const boost::xpressive::detail::mark_tag&)Several of the above errors are emitted when compiling... I'll try more tomorrow.