lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Howdy,

I'm having a few problems getting around MSVC calling
conventions when registering a function with lua.

For example, in a c++ program, the function
int test(lua_State *L);
is internally translated to int (__cdecl)(struct
lua_State *).

You can turn off the __cdecl definition by
substituting the macro __declspec(naked), but that
imposes the restriction of not being able to return a
value (such as int, which is required).

Anybody hurdled this one in MSVC++? I'd like to keep
function call safety in the linker. The complete
compiler error message is:
error C2664: 'lua_pushcclosure' : cannot convert
parameter 2 from 'int (struct lua_State *)' to 'int
(__cdecl *)(struct lua_State *)'

It's a member function, being registered in a
constructor.

Thanks and regards,
Simon Haines

http://movies.yahoo.com.au - Yahoo! Movies
- Vote for your nominees in our online Oscars pool.