lua-users home
lua-l archive

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


Fabio Mascarenhas wrote:
Well, guess I spoke too soon about libffi! The documentation is pretty sketchy, but I dug around in the source of the CVS version of libffi and found how to do callbacks. So after some hours of late night hacking I ripped out ffcall and put libffi in its place. The Alien API remains the same, so I am calling this version 0.3.1.
Just a note: on AMD64 it appears that test_libc.lua works.
The normal tests do not, though... it segfaults @ _testfunc_callback_i_if ()

BT:
#0  0x00000000005157e8 in ?? ()
#1 0x00002ae74fc98544 in _testfunc_callback_i_if (value=262144, func=0x5157e8)
   at tests/alientest.c:155
#2 0x00002ae74f88fbe0 in ffi_call_unix64 () from /usr/local/lib/lua/5.1/alien.so
#3  0x00002ae74f88f629 in ffi_call (cif=0x7fff5b247810,
   fn=0x2ae74fc98530 <_testfunc_callback_i_if>, rvalue=0x7fff5b24784c,
   avalue=0x7fff5b2477a0) at src/x86/ffi64.c:428
#4 0x00002ae74f88e74b in alien_function_call () from /usr/local/lib/lua/5.1/alien.so


Tried tracking it down to make sense of it... it almost looks like the function address is being truncated to 32-bits...