lua-users home
lua-l archive

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


2009/5/14 Lloyd <lloyd@cdactvm.in>:
> I again tried with changing the "my_c_function" like this
>
> int __declspec(dllexport) my_c_function(lua_State* L)
> {
>  const char* name = luaL_checkstring(L, 1);
>  printf("Hello %s!\n", name);
>  return 0;
> }
>
> Again I am getting the same error message. Where am I making mistake?

Are you compiling your file as C or as C++ ? If your source file is a
C++ file you should write:

extern "C" __declspec(dllexport) int my_c_function(lua_State* L)
{
 const char* name = luaL_checkstring(L, 1);
 printf("Hello %s!\n", name);
 return 0;
}