I have been using luabind-0.8.1 to wrap a number of C++ class for some
time. These classes are used both in straight lua, as well as in
situations where lua is used for configuration, with values read back
into C++. This setup has worked great on osx and windows (32-bit).
Recently, I have been testing the same code on linux (ubuntu 10.04-64
bit, gcc 4.4.3) and have been unable to access the wrapped classes
from C++. Spefically, any time I try to cast a luabind::object back to
a wrapped class, I get a cast_failed exception.
In an effort to diagnose the problem, I have generated the following
toy example which, to the best of my knowledge, should work fine. The
full example is attached.
The idea here is to wrap a simple vec3 class. The class is compiled
into a shared lib. This lib is then wrapped using luabind so vec3 is
available in lua. However, attempting to access the code from C++
causes a cast_failed exception.
(see output below).
I have tried testing the code with different versions of gcc,
different version of luabind 0.8.1 and 0.9.0, both static and dynamic
versions of luabind and the exception persists. Though I am proficient
at C++, I have limited experience with template metaprogramming and
have not attempted to step through the code to figure out what is
going on "under the hood".
Any ideas with what could be causing this type of issue?