Reputation: 2648
I am trying to use Luabind's properties when importing a class. The definitions are all correct, of this I am sure, but when I call upon a property, such as to print it if it's a string or number, I get something like this
function: 009EC440
Now I have no idea why this is happening, but I have looked around on the internet and have found several people with the same problem. They say you should build Luabind with these parameters:
bjam toolset=msvc-9.0 variant=debug threading=multi link=shared define=_BIND_TO_CURRENT_VCLIBS_VERSION
Now I have tried this, but I still get the same error. Another thing to note is that I am using MSVC 2012, so I have tried to build it with toolset=msvc-11.0, but again to no avail. I have read that you need to define LUABIND_DYNAMIC_LINK if you are not using Boost build to build your project, which I have also done right before the include of Luabind. This has still caused this error. I have also tried to build Luabind myself, but have run into trouble linking it as it raises many symbol errors (I am not sure where to define LUABIND_DYNAMIC_LINK, so if someone knows this might fix the problem). Does anyone know how to fix this issue?
Here is the code for declaring the properties:
luabind::module(luaState)[
luabind::class_<Weapon>("Weapon")
.def(luabind::constructor<float, float>())
.def_readwrite("onFire", &Weapon::onFireFunc)
.def_readonly("modifier", &Weapon::modifier)
];
And they are attempting to be accessed like so, with weapon being an instance of the Weapon class as declared with it's constructor:
print(weapon.modifier)
weapon.onFire = onFire
Statically linking works, but I would like to make it work with dynamic linking, using these parameters:
bjam toolset=msvc-9.0 variant=debug threading=multi link=static define=_BIND_TO_CURRENT_VCLIBS_VERSION
Upvotes: 2
Views: 648
Reputation: 26
I had the same problem on VS2008. (this is 6 mos after the post, but may help someone else)
I fixed it by adding the LUABIND_DYNAMIC_LINK preprocessor directive.
Project->Properties->C/C++->Preprocessor
Add LUABIND_DYNAMIC_LINK to the list of Preprocessor definitions.
I built luabind using the same bjam command you have at the top of your post.
Upvotes: 1