Most of the time, when you compile a shared library, executing it is meaningless and doing so produces nothing useful:
$ ./libfoobarbaz.so Segmentation fault
The answer lies in the name "Executable and Linking Format". The same file format is used for both executables and libraries.