I dont know if this is still relevant with assembler but I want to compile a C code and make it as a lib for MASM. Im lazy to direct translate it.
This may or may not help you: http://www.adp-gmbh.ch/cpp/gcc/create_lib.html
I'm not sure that every detail is correct, but the example in the attachment appears to work OK. The library contains only a single C function, and I added to it a call to printf so I could determine how to use a library that accessed the CRT.