[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Registering C functions in C++ (Win32)
- From: simon <simonhaines@...>
- Date: Fri, 22 Feb 2002 14:09:00 +1100 (EST)
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
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
Thanks and regards,
http://movies.yahoo.com.au - Yahoo! Movies
- Vote for your nominees in our online Oscars pool.