次のコードは、SIGSEGV エラーで終了します。
extern "C" {
#include "lua/lua.h"
#include "lua/lualib.h"
#include "lua/lauxlib.h"
}
int main( int argc, char *argv[] )
{
lua_State *L;
luaL_openlibs(L);
lua_close(L);
return 0;
}
Gdbは私に次のことを教えてくれます:
(gdb) run
Starting program: d:\Dropbox\cpp\engine\bin\main.exe
[New Thread 7008.0x1df8]
Program received signal SIGSEGV, Segmentation fault.
0x6d781f30 in lua_pushcclosure () from d:\Dropbox\cpp\engine\bin\lua52.dll
(gdb) where
#0 0x6d781f30 in lua_pushcclosure () from d:\Dropbox\cpp\engine\bin\lua52.dll
#1 0x6d79329e in luaL_requiref () from d:\Dropbox\cpp\engine\bin\lua52.dll
#2 0x6d79bdee in luaL_openlibs () from d:\Dropbox\cpp\engine\bin\lua52.dll
#3 0x004013a6 in main (argc=1, argv=0x702fc8) at main.cpp:10
(gdb)