integer function multiply(a, b) integer, intent(in) :: a, b multiply = a * b integer function addtwo(a, b) integer, intent(in) :: a, b addtwo = a + b $ gfortran -shared -fPIC -g -o mult.so mult.f90 $ gfortran -shared -fPIC -g -o add.so add.f90 $ nm -ao mult.so | grep multiply mult.so:00000000000005cc T multiply_ $ python3 testfunc.py 8 6 $ python3 -m numpy.f2py secret.f90 -m secretcode -h secret.pyf $ python3 -m numpy.f2py -c secret.pyf secret.f90 $ ls -s total 120 112 secretcode.cpython-37m-x86_64-linux-gnu.so 4 secret.f90 4 secret.pyf $ f2py --f90flags=-fopenmp -L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/ -lgomp -c -m test test.f90 $ python3 test1.py hello world. The secret number is 6