mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Fix function pointer lookup for calls.
This commit is contained in:
parent
9502afb35b
commit
d215747fd5
@ -340,14 +340,15 @@ int lj_ccall_func(lua_State *L, GCcdata *cd)
|
|||||||
{
|
{
|
||||||
CTState *cts = ctype_cts(L);
|
CTState *cts = ctype_cts(L);
|
||||||
CType *ct = ctype_raw(cts, cd->typeid);
|
CType *ct = ctype_raw(cts, cd->typeid);
|
||||||
CTSize sz = ct->size;
|
CTSize sz = CTSIZE_PTR;
|
||||||
void *p = cdataptr(cd);
|
if (ctype_isptr(ct->info)) {
|
||||||
if (ctype_isptr(ct->info))
|
sz = ct->size;
|
||||||
ct = ctype_rawchild(cts, ct);
|
ct = ctype_rawchild(cts, ct);
|
||||||
|
}
|
||||||
if (ctype_isfunc(ct->info)) {
|
if (ctype_isfunc(ct->info)) {
|
||||||
CCallState cc;
|
CCallState cc;
|
||||||
int gcsteps, ret;
|
int gcsteps, ret;
|
||||||
cc.func = (void (*)(void))cdata_getptr(p, sz);
|
cc.func = (void (*)(void))cdata_getptr(cdataptr(cd), sz);
|
||||||
gcsteps = ccall_set_args(L, cts, ct, &cc);
|
gcsteps = ccall_set_args(L, cts, ct, &cc);
|
||||||
lj_vm_ffi_call(&cc);
|
lj_vm_ffi_call(&cc);
|
||||||
gcsteps += ccall_get_results(L, cts, ct, &cc, &ret);
|
gcsteps += ccall_get_results(L, cts, ct, &cc, &ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user