Hacker Newsnew | comments | show | ask | jobs | submit login

LuaJIT's "running" page http://luajit.org/running.html suggests linking with -E (gcc -Wl,-E) to make all your global symbols visible to dlsym() even when you statically link.

That's what we're doing in Snabb Switch http://snabb.co/snabbswitch/ to create a statically linked executable that heavily uses FFI. (Currently don't statically link libc though so I don't know if there is a particular gotcha there.)




I think it won't work if you statically link LuaJIT too. I think it still uses dlopen, which with glibc still needs the dynamic libc available at run time, and might not work with other libcs. But you could fake it all with a statically linked table of function pointers quite easily I guess.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: