Executing a shared library on Unix

The below definition of main is responsible for printing the output you see. It is defined in csu/version.c of the source tree of glibc. I hope this helps.

#ifdef HAVE_ELF
/* This function is the entry point for the shared object.
   Running the library as a program will get here.  */

extern void __libc_main (void) __attribute__ ((noreturn));
void
__libc_main (void)
{
  __libc_print_version ();
  _exit (0);
}
#endif

Leave a Comment