Abstract out on-demand loading of FFI library.

This commit is contained in:
Mike Pall
2021-06-01 01:01:15 +02:00
parent 61990cef05
commit 50d6883e60
4 changed files with 13 additions and 15 deletions

View File

@@ -399,11 +399,7 @@ static int bcread_header(LexState *ls)
if ((flags & BCDUMP_F_FFI)) {
#if LJ_HASFFI
lua_State *L = ls->L;
if (!ctype_ctsG(G(L))) {
ptrdiff_t oldtop = savestack(L, L->top);
luaopen_ffi(L); /* Load FFI library on-demand. */
L->top = restorestack(L, oldtop);
}
ctype_loadffi(L);
#else
return 0;
#endif