boost::bind on luabind::call_function

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

boost::bind on luabind::call_function

piers august
Hi,

I want to bind
template<class Ret>
Ret call_function(lua_State* L, const char* name, ...)
with boost::bind for calling boost::asio::io_service::post but get
 error: address of overloaded function with no contextual type information
from this line of code:

ioService_.post( boost::bind( (void (*)(lua_State*,const char*,...)) &luabind::call_function<void>, L));

Wrapping the call to luabind::call_function in a function and posting that to io_service (with bind) works fine but I don't want to create a wrapper function for the range of argument lists and types.

details
BOOST_LIB_VERSION=1_48
LUA_VERSION_NUM=501
LUABIND_VERSION=900
G++ VERSION=4.4.6 20110731 (Red Hat 4.4.6-3)

Thanks
Piers


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: boost::bind on luabind::call_function

Szymon Gatner
Did you try with luabind::object instead of call_function? It has
operator() for when object is a lua function. Bind may require
result_type typedef tho so not sure if this would work.

You could also try binding object to boost::function<void> first, to
provide result_type and then pass it to io_state.post().

BTW if you are using asio as a thread pool, keep in mind that it is
not safe to operate on single lua_State from multiple threads at the
same time

Cheers

2013/2/1 piers august <[hidden email]>:

> Hi,
>
> I want to bind
>
> template<class Ret>
> Ret call_function(lua_State* L, const char* name, ...)
>
> with boost::bind for calling boost::asio::io_service::post but get
>  error: address of overloaded function with no contextual type information
> from this line of code:
>
> ioService_.post( boost::bind( (void (*)(lua_State*,const char*,...))
> &luabind::call_function<void>, L));
>
> Wrapping the call to luabind::call_function in a function and posting that
> to io_service (with bind) works fine but I don't want to create a wrapper
> function for the range of argument lists and types.
>
> details
> BOOST_LIB_VERSION=1_48
> LUA_VERSION_NUM=501
> LUABIND_VERSION=900
> G++ VERSION=4.4.6 20110731 (Red Hat 4.4.6-3)
>
> Thanks
> Piers
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_jan
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>



--
Szymon Gatner
The Lordz Games Studio
www.thelordzgamesstudio.com

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user