🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

c# and lua dll

Started by
20 comments, last by arthc 20 years, 11 months ago
quote: Original post by Arild Fines
The DllImport attribute allows you to specify the calling convention:

[DllImport( "lua", CallingConvention = CallingConvention.Cdecl )private static extern somefunc( UIntPtr L );  


Unfortunately, C# doesn''t allow you to set the calling convention on a callback(however, MC++ and MSIL does). See the following thread: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=ew6mLkV6BHA.1932%40tkmsftngp03&rnum=1&prev=/groups%3Fq%3Dcalling%2Bconvention%2Bdelegate%2Bgroup%253Amicrosoft.public.dotnet.*%26btnG%3DGoogle%2BSearch%26hl%3Den%26lr%3D%26ie%3DISO-8859-1


AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.


hmm.. i''m don''t really understand this. what does it mean ?
Advertisement
FINALLY! it works!
i changed every function definition in the lua library from "static int func(lua_State *L)" to "static int __stdcall funct(lua_state *L)" and it works! also i changed the lua_CFunction:
// Oldtypedef int (*lua_CFunction)(lua_State *);// Working!typedef int (__stdcall * lua_CFunction)(lua_State *);

This topic is closed to new replies.

Advertisement