William Adams wrote: > I get a crash trying to use a FFI function from a module. The module is unloaded, since the namespace handle is garbage collected. > local Lib = ffi.load("psapi"); > return { > EnumProcesses = Lib.EnumProcesses, > } You need to anchor 'Lib' somewhere. E.g. in the returned table. http://luajit.org/ext_ffi_semantics.html#clib --Mike