Re: Assert thrown calling basic C++ function

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On 7/29/09 1:11 AM, Brian Hughes wrote:
> Hello everyone,
> 
> I’m a new user to both Lua and LuaBind, so I’m hoping I’m just making a
> simple mistake in my program! I’m implanting Lua/LuaBind into an
> existing codebase.
>  
> 
> I’m starting by doing a very basic test of calling a global C++ function
> from within a lua script. Nothing fancy, however it is throwing an
> assert trying to call the function.
>  
> 
> I do all of the setup (open lua state, open lua libs, open luabind),
> then define my function as follows:
> 
>       luabind::module(gScriptManager->GetState())
>       [
>             luabind::def("sayhello", &sayhello)
>       ];
> 
>  
> 
> Where sayhello is quite basic:
> 
> 
> void sayhello(void)
> {
>       return;
> }
> 
> However, when I try to run a script that only has: sayhello()  in it,
> luaL_dofile returns a value of 1 (some error, which is supposedly a
> YIELD error?), and when I use Decoda to debug Lua, it is throwing an
> assert when it tries to call the function.

Where does it assert?

> I’m using Lua 5.1.4 with LuaBind 0.8.1 on MS Visual Studio 2005.

How are you building luabind? It can obviously handle this basic usage,
so it doesn't seem very likely it's a bug in the library. Can you supply
the complete failing code (C++ and Lua) please?

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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.