|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
win32 __stdcall function supportHi all,
I discovered that standard win32 api functions could not be called directly due to the __stdcall modifier. I did a minor change to luabind to support this and have included the patch (against r513) here in case anyone else need to do this. Dave Hawkes, Cadlink Technology Index: config.hpp =================================================================== --- config.hpp (revision 513) +++ config.hpp (working copy) @@ -28,6 +28,7 @@ #ifdef BOOST_MSVC #define LUABIND_ANONYMOUS_FIX static + #define LUABIND_CALLTYPE __stdcall #else #define LUABIND_ANONYMOUS_FIX #endif Index: function.hpp =================================================================== --- function.hpp (revision 513) +++ function.hpp (working copy) @@ -44,6 +44,8 @@ #include <luabind/scope.hpp> +#define LUABIND_CALLTYPE_ITER + namespace luabind { namespace detail @@ -59,6 +61,14 @@ #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 1)) #include BOOST_PP_ITERATE() +#ifdef LUABIND_CALLTYPE +#undef LUABIND_CALLTYPE_ITER +#define LUABIND_CALLTYPE_ITER LUABIND_CALLTYPE +#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 1)) +#include BOOST_PP_ITERATE() +#undef LUABIND_CALLTYPE_ITER +#define LUABIND_CALLTYPE_ITER +#endif // LUABIND_CALLTYPE inline bool operator==(const overload_rep& o) const { @@ -144,6 +154,14 @@ { #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 2)) #include BOOST_PP_ITERATE() + #ifdef LUABIND_CALLTYPE + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER LUABIND_CALLTYPE + #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 2)) + #include BOOST_PP_ITERATE() + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER + #endif // LUABIND_CALLTYPE }; template<> @@ -151,10 +169,26 @@ { #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 3)) #include BOOST_PP_ITERATE() + #ifdef LUABIND_CALLTYPE + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER LUABIND_CALLTYPE + #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 3)) + #include BOOST_PP_ITERATE() + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER + #endif // LUABIND_CALLTYPE }; #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 4)) #include BOOST_PP_ITERATE() + #ifdef LUABIND_CALLTYPE + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER LUABIND_CALLTYPE + #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 4)) + #include BOOST_PP_ITERATE() + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER + #endif // LUABIND_CALLTYPE #undef LUABIND_PARAMS @@ -166,6 +200,14 @@ #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 5)) #include BOOST_PP_ITERATE() + #ifdef LUABIND_CALLTYPE + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER LUABIND_CALLTYPE + #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/function.hpp>, 5)) + #include BOOST_PP_ITERATE() + #undef LUABIND_CALLTYPE_ITER + #define LUABIND_CALLTYPE_ITER + #endif // LUABIND_CALLTYPE template<class F, class Policies> @@ -319,7 +361,7 @@ #define LUABIND_ARITY(z,n,text) + BOOST_PP_CAT(p,n)::has_arg template<class R BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A), class Policies> -overload_rep(R(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), Policies*) +overload_rep(R(LUABIND_CALLTYPE_ITER *f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), Policies*) : fun(reinterpret_cast<void(*)()>(f)) { m_params_.reserve(BOOST_PP_ITERATION()); @@ -336,7 +378,7 @@ #elif BOOST_PP_ITERATION_FLAGS() == 2 template<class Policies BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)> -static int call(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies*) +static int call(T(LUABIND_CALLTYPE_ITER *f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies*) { int nargs = lua_gettop(L); @@ -364,12 +406,10 @@ return maybe_yield<Policies>::apply(L, nret); } - - #elif BOOST_PP_ITERATION_FLAGS() == 3 template<class Policies BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)> -static int call(void(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies*) +static int call(void(LUABIND_CALLTYPE_ITER *f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies*) { int nargs = lua_gettop(L); @@ -394,11 +434,10 @@ return maybe_yield<Policies>::apply(L, nret); } - #elif BOOST_PP_ITERATION_FLAGS() == 4 template<class Policies, class R BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)> -int call(R(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies* policies) +int call(R(LUABIND_CALLTYPE_ITER *f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies* policies) { return free_functions::returns<R>::call(f, L, policies); } @@ -406,14 +445,12 @@ #elif BOOST_PP_ITERATION_FLAGS() == 5 template<class Policies, class R BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)> - static int match(R(*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies* policies) + static int match(R(LUABIND_CALLTYPE_ITER *)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, const Policies* policies) { //if (lua_gettop(L) != BOOST_PP_ITERATION()) return -1; typedef constructor<BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)> ParameterTypes; return match_params(L, 1, static_cast<ParameterTypes*>(0), policies); } - - #endif ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ luabind-user mailing list luabind-user@... https://lists.sourceforge.net/lists/listinfo/luabind-user |
|
|
Re: win32 __stdcall function supportDave Hawkes wrote:
> Hi all, > > I discovered that standard win32 api functions could not be called > directly due to the __stdcall modifier. I did a minor change to luabind > to support this and have included the patch (against r513) here in case > anyone else need to do this. Could you create a ticket for this on http://code.rasterbar.com/luabind and attach the patch there? It's hard to apply this because of the line breaks. -- Daniel Wallin BoostPro Computing http://www.boostpro.com ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ luabind-user mailing list luabind-user@... https://lists.sourceforge.net/lists/listinfo/luabind-user |
|
|
Re: win32 __stdcall function supportDaniel Wallin wrote:
> Dave Hawkes wrote: > >> Hi all, >> >> I discovered that standard win32 api functions could not be called >> directly due to the __stdcall modifier. I did a minor change to luabind >> to support this and have included the patch (against r513) here in case >> anyone else need to do this. >> > > Could you create a ticket for this on http://code.rasterbar.com/luabind > and attach the patch there? It's hard to apply this because of the line > breaks. > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ luabind-user mailing list luabind-user@... https://lists.sourceforge.net/lists/listinfo/luabind-user |
| Free Forum Powered by Nabble | Forum Help |