SWIG/Lua wrapping boost::shared_ptr?

This topic is 4053 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello everyone. Suppose I have the following Cpp code:
class Foo
{
const char * bar();
...
};

typedef boost::shared_ptr<Foo> pFoo;

// And:

pFoo make_foo()
{
// .. somehow created.
}


What do I write in the SWIG interface file, so that pFoo can be used i Lua code? Naively, I tried to just include boost/shared_ptr.hpp, but the result was horrible (glue code did not compile). I also simply tried this, after some googling.
namespace boost {
template<class T> class shared_ptr
{
public:
T * operator-> () const;
};
}


I can call make_foo() without problems, but the returned object is only recognized as general userdata, and I get an error when I try to call foovarname:bar(). Is it impossible, or am I simply retarded? (Hopfully the latter). rude

Share on other sites

This topic is 4053 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.