[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: calling c from inside a coroutine
- From: Gedalia Pasternak <gedalia@...>
- Date: Thu, 13 May 2010 15:27:24 -0400
Hi List,
I'm scratching my head over this one, typically I use swig to automate calling c++ objects which has worked great. I've been integrating lqt which uses a different binding system to let me drive my UI. This has resulted in having to hand write some glue functions.. (mostly functions to push QT objects onto the stack). I've started noticing odd differences if my c function is called from a straight script vs from inside a coroutine.
Things work fine inside a simple linear script (stack is empty when called), but if the call is done from inside a coroutine I get a stack with a single entry: thread . Presumably that's the coroutine? I've never seen this before, and it doesn't seem to be the case when I've inspected the stack in swigged functions. This seems to have an odd behavior on the return side:
A function as simple as:
{
lua_State* L = (lua_State*)m_manager->get_lua_state();
const char* test = "testing";
lua_pushstring(L, test);
return 1;
}
when called from inside a coroutine results in it returning a function not a string. This just seems like it should be crazy simple, but I can't figure out what I'm missing.
-gedalia
--
---------------------------------------------------------------
http://www.gedalia.net
---------------------------------------------------------------
Fight Entropy!!! Fight Entropy!!! Figth Etnropy! !
iFgth Etnrop!y ! giFth tErno!py ! giFt htrEno!p y! --- Well maybe
not...