Functions not binding properly after upgrading to 0.9

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Functions not binding properly after upgrading to 0.9

Benjamin Miller - Applications Engineering

Recently we upgraded from 0.8.1 to 0.9.  This has resulted in scripts, which previously functioned, to begin generating errors like this:

 

Error: 15:31:06 .\src\BasicApp.cpp BasicApp::App::CallLuaHandler() line 531

Lua function DefaultTable:MainLoop encountered an error: ...\Engine\Common\Scripts\BasicApp.lua:120: attempt to call method 'SendMsg' (a nil value)

 

The software is structured with the engine in a dll and small application that initializes the engine, then executes various scripts.  The scripts fail on calls to C++ functions that should be already bound.  The problem seems to be centered on binding the functions of the external application.  Essentially, when I bind things with the macros that we created to help expedite the process, functions in the external application fail to bind.  When I remove those macros and do everything by hand, I get an error telling me a function in the engine dll isn’t bound.  Removing all bindings in the external application results in a failure at the unbound function as expected.  However, the engine function that was supposedly unbound, now executes.  I’ve looked through the lua tables in both circumstances, and the namespaces and classes all appear the same and are where I expect them to be.  Our bindings are fairly simplistic, generally following this format:

 

lua_State * luaState = Engine::LuaCore::GetLua()->GetLuaEnvironment();

 

module(luaState, "BasicApp")

[

    class_<App>("App")

        .def("SendMsg", (bool(App::*)(StringRefC, StringRefC))&App::SendMsg)

        .def("SendMsg", (bool(App::*)(StringRefC, StringRefC, StringRefC))&App::SendMsg)

        .def("SendExitApp", &App::SendExitApp)

                .

                .

                .

];

 

The macros don’t really change this, they merely instantiate some helper functions and objects which automate the calls to the binding code.  The most significant difference is probably that the binding is done within the dll.  The script code that is failing looks like this:

 

self.app:SendMsg("SetScenarioState", tostring(Engine.RObject.RUNTIME_STATE))

 

I’ve checked to see if the object is nil and that is not the case.  At this point, I suspect there is something wrong with the userdata, however I am still new to lua and luabind so I haven’t been able to troubleshoot that yet.

 

 



Privileged/Confidential Information may be contained in this email.  If you are not the addressee indicated in this email (or responsible for delivery of the message to such person), you may not copy or deliver this email to anyone.  In such case, you should destroy this email and kindly notify the sender by phone at (386) 267-2936.  Please advise immediately if you or your employer do not consent to emails of this kind. Not for release to foreign persons: controlled under U.S. Federal Regulations. Opinions, conclusions and other information in this email that do not relate to the official business of Raydon Corporation shall be understood as neither given nor endorsed by it.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: Functions not binding properly after upgrading to 0.9

Daniel Wallin
Hi Benjamin,

On Tue, Mar 09, 2010 at 01:11:56PM -0500, Benjamin Miller - Applications Engineering wrote:
> Recently we upgraded from 0.8.1 to 0.9.  This has resulted in scripts,
> which previously functioned, to begin generating errors like this:
[...]
> The macros don't really change this, they merely instantiate some helper
> functions and objects which automate the calls to the binding code.  The
> most significant difference is probably that the binding is done within
> the dll.

Do you define LUABIND_DYNAMIC_LINK when building and linking against the
luabind DLL? That's the only problem I can think of right now.

--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user