Possible duplicate:dlopen from memory?
I have seen this for Windows DLLs that are loaded from the memory buffer, but I cannot find it anywhere on Linux, and the "ld" source code is the most complex code I have ever seen. So:
Is there any example of loading .so files from memory? Even simple, which can I finish? I just don't know where to start, although I read most of the ELF specifications that are still mysterious to me.
: ld . dlopen dlsym, libc. , : ld-linux.so( ; ldd /bin/ls, , ).
ld
dlopen
dlsym
ldd /bin/ls
ELF , ; ABI ( 32- 64- Linux, .)
( , SO), X11: , , , - .
" .so "?
.so
*.so, . dlopen .
*.so
, ? ? ? ( ELF ELF ?)
, ELF *.so, (.. ) - ( , tmpfs, ). dlopen, .
tmpfs
ELF .so, , . , (, LLVM, GCCJIT, libjit, GNU, LuaJit....).
, , mmap mprotect (, ).
You need the dlopen () family of functions (on GNU / Linux they are defined in /usr/include/dlfcn.h).
As an example, consider how PHP makes modules .