Talk:Executable library: Difference between revisions

Content added Content deleted
(→‎executable Shared Objects?: Special code to call main().)
Line 16: Line 16:
: ELF != Unix -- you just need a different file format (and, thus, a different "interpreter"). But the problem with elf is e_type where 2 is "executable file" and 3 is "shared object" http://linux.die.net/man/5/elf --[[User:Rdm|Rdm]] 13:07, 19 April 2011 (UTC)
: ELF != Unix -- you just need a different file format (and, thus, a different "interpreter"). But the problem with elf is e_type where 2 is "executable file" and 3 is "shared object" http://linux.die.net/man/5/elf --[[User:Rdm|Rdm]] 13:07, 19 April 2011 (UTC)
::: There are other problems with ELF shared objects. With systems like [[OpenBSD]], an executable needs some [http://www.openbsd.org/cgi-bin/cvsweb/src/lib/csu/amd64/crt0.c?rev=1.3 special code] to initialize certain variables (like <tt>environ</tt> and <tt>__progname</tt>), to call <tt>main()</tt> and to call <tt>exit()</tt> with the return value from main. A shared object misses this special code, so you cannot start a shared object as an executable. --[[User:Kernigh|Kernigh]] 17:11, 19 April 2011 (UTC)
::: There are other problems with ELF shared objects. With systems like [[OpenBSD]], an executable needs some [http://www.openbsd.org/cgi-bin/cvsweb/src/lib/csu/amd64/crt0.c?rev=1.3 special code] to initialize certain variables (like <tt>environ</tt> and <tt>__progname</tt>), to call <tt>main()</tt> and to call <tt>exit()</tt> with the return value from main. A shared object misses this special code, so you cannot start a shared object as an executable. --[[User:Kernigh|Kernigh]] 17:11, 19 April 2011 (UTC)
:::: I think I am missing something here. Why can't an elf shared object be made to contain this code? --[[User:Rdm|Rdm]] 18:18, 19 April 2011 (UTC)