On 11/30/2014 07:33 PM, Yichun Zhang (agentzh) wrote:
You need to anchor the "l" variable's value (returned by ffi.load) in your Lua module test2.lua somehow. Right now it is not anchored and can get GC'd prematurely. Valgrind reports the error
Thanks! That makes sense now that I think about it. Also sticking the 'l' variable inside "lib" seems to work as well to keep it alive.
Thanks for the tip on the collectgarbage hook, that will come in handy. -- Chris http://luadev.com