gcc -c add.c -o add.o
gcc -shared -o libadd.so add.o
gcc -o main.exe main.c libadd.so

I only figured out today how easy it is to link to dlls with mingw, only need to reference the dll as if it was a library

this is not documented in the mingw pages

also dont have information about how to create a simple static library, now I know after a lot of search that 'ar rcs lib.a file.o file2.o' will create the library for me 

But anyway, thank you mingw developers for the great tool