From: Robert Klemme Date: 2007-12-28T07:19:59+09:00 Subject: Re: C++ Functors and Ruby extensions On 27.12.2007 15:46, Jason Roelofs wrote: > [Note: parts of this message were removed to make it a legal post.] > > On Dec 27, 2007 7:36 AM, Robert Klemme wrote: > >> 2007/12/27, Jason Roelofs : >>> SWIG does not handle nested classes, a *serious* defect to what I'm >> trying >>> to do. I've looked into helping add this feature, but the amount of work >>> required makes it more feasible to build a better, Ruby-specific wrapper >>> system. >> I'm not too familiar with Boost. So could you quickly summarize what >> is it that you expect to gain from creating a Boost Ruby integration? >> >> Kind regards >> >> robert >> >> >> -- >> use.inject do |as, often| as.you_can - without end >> >> > Boost.Python and luabind are libraries built to make it extremely easy to > build interfaces into the target language from C++. It's not really about > integration with Boost, Boost just provides some very, very useful > constructs and a powerful meta-programming subsystem that makes this library > feasible in such a strict language. Here's what you're able to do: > > Wrap this: > > class A { > public: > A(); > A(int, int); > > void doSomething(); > int getSomethingBack(); > }; > > Like this: > > class_("A") > .def(initialize()) > .def("do_something", &A::doSomething) > .def("get_something_back", &A::getSomethingBack); > > and in Ruby > > a1 = A.new > a = A.new(1,2) > > a.do_something > a.get_something_back Thanks for taking the time to explain! I was not aware that something like this is part of Boost. > For those of you pushing SWIG, trust me, I've spent many, many hours trying > different ways to make nested classes work in a way that won't require me to > re-write a full quarter of the headers that I'm trying to wrap (Ogre > rendering engine, for the record). Nested classes are *not* supported in > SWIG, there are hacks to make it look so, hacks that do not work all of the > time. Kind regards robert