lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo <> 于2020年4月15日周三 下午9:45写道:
> Lua 5.4.0 (rc1) is now available for testing at

I built it in x86_64-w64-mingw32 , gcc version 8.2.0 (Rev1, Built by
MSYS2 project), it reports a warning :

loadlib.c:209:21: warning: cast between incompatible function types
from 'FARPROC' {aka 'long long int (*)()'} to 'int (*)(lua_State *)'
{aka 'int (*)(struct lua_State *)'} [-Wcast-function-type]
   lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym);

I guess we can cast it to `cast first to void (*)(void)` first to fix it,

  lua_CFunction f = (lua_CFunction)(void
(*)(void))GetProcAddress((HMODULE)lib, sym);

It looks ugly, but it works.