The proper way is to write an extension module. But if you're doing simple stuff (such as adding two integers) than can be done independently of Python, you can just write a regular shared library in C (which would be a DLL on Windows), and load it using the ctypes module.
For example:
// C code
int Add(int a, int b) { return a + b; }
Compile that like this:
gcc add.c -fPIC -shared -o libadd.so
Then use it in Python like this:
import ctypes
libadd = ctypes.cdll.LoadLibrary('libadd.so')
libadd.Add.argtypes = [ctypes.c_int, ctypes.c_int]
libadd.Add.restype = ctypes.c_int
print libadd.Add(42, 1) # Prints 43