Jump to content
  • Advertisement
Sign in to follow this  
rudeness

SWIG/Lua wrapping boost::shared_ptr?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!