On 6 March 2014 15:36, Mike Pall <mike-1403@xxxxxxxxxx> wrote: > > Daurnimator wrote: > > To get a handle to the always-in-memory shared object, the standard > > mechanism is to call:`dlopen("linux-vdso.so.1",RTLD_LAZY)` > > However; clib_extname prepends 'lib' if a '/' is not present is the first > > argument. > > > > Is there a way around this in the LuaJIT ffi? > > Given that it needs special flags, anyway, why not call dlopen > directly via the FFI? > > --Mike What are the special flags? ffi.load uses RTLD_LAZY already: http://repo.or.cz/w/luajit-2.0.git/blob/80efb077500ca368b26aab0aadcc4e2e877b10ab:/src/lj_clib.c#l117 I wanted to keep using ffi abilities like cdef to declare functions. Is this functionality possible to retain somehow? e.g. If ffi.cast worked liked this: ffi = require"ffi" ffi.cdef [[ void *dlopen(const char *filename, int flag); void *dlsym(void *handle, const char *symbol); typedef long time_t; time_t __vdso_time(time_t *t); ]] linux = ffi.C.dlopen("linux-vdso.so.1",1) time = ffi.cast("__vdso_time",ffi.C.dlsym(linux, "__vdso_time")) print(time(nil))