GCC -shared option

-shared
Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option. For predictable results, you must also specify the same set of options used for compilation (-fpic, -fPIC, or model suboptions) when you specify this linker option.

Example :

gcc -fpic -c hellomodule.c hello_wrap.c -I/usr/include/python3.4/
gcc -shared hellomodule.o hello_wrap.o -o _hello.so

Reference :

https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html