bind variadic functions

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

bind variadic functions

chrislu
Hi,
is it possible to bind functions like:

int custom_printf(const char* format, ...)
{...}

using luabind? When i try to bind it i always get the follwing errors:

Bind trials:
def("cprintf", &custom_printf)
def("cprintf", (int(*)(const char*, ...))&custom_printf)

Errors:
./../../../ext/inc/luabind\luabind/function.hpp(227) : error C2660:  
'luabind::detail::free_functions::overload_rep::overload_rep' : function  
does not take 2 arguments
1>        ./../../../ext/inc/luabind\luabind/function.hpp(226) : while  
compiling class template member function 'void  
luabind::detail::function_commiter<F,Policies>::register_(lua_State *)  
const'
1>        with
1>        [
1>            F=int (__cdecl *)(const char *,...),
1>            Policies=luabind::detail::null_type
1>        ]
1>        ./../../../ext/inc/luabind\luabind/function.hpp(303) : see  
reference to class template instantiation  
'luabind::detail::function_commiter<F,Policies>' being compiled
1>        with
1>        [
1>            F=int (__cdecl *)(const char *,...),
1>            Policies=luabind::detail::null_type
1>        ]
1>        ..\..\..\src\app_script_tests\main.cpp(78) : see reference to  
function template instantiation 'luabind::scope luabind::def<int(__cdecl  
*)(const char *,...)>(const char *,F)' being compiled
1>        with
1>        [
1>            F=int (__cdecl *)(const char *,...)
1>        ]


Thx
--
Christopher Lux |
                 | Bauhaus University Weimar
                 | Faculty of Media - Virtual Reality Systems Group

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: bind variadic functions

Arvid Norberg-2
On Wed, Sep 13, 2006 at 09:39:37AM +0200, Christopher Lux wrote:
> Hi,
> is it possible to bind functions like:
>
> int custom_printf(const char* format, ...)
> {...}
>
> using luabind? When i try to bind it i always get the follwing errors:

No, it's not. Since it's not type safe it's impossible to get any type information, and apply
any converters on the values.

--
Arvid Norberg

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user