An advantage to using gcc is that gcc "knows where the bodies are buried" and can produce the "right" command line for ld. I think you'll need "-lc" in there.
A confusing error I've encountered is to have the thing link without complaint, and a "file not found" error when you try to run it. Seems that, by default, ld (some versions) tries to use "/lib/ld-linux.so.1" as the "interpreter" or "dynamic linker", and this doesn't exist (on some systems). The solution is to tell ld "-I /lib/ld-linux.so.2" (exists on my system). Your system may not have this problem, or the solution may be different (one of the things gcc "knows about").
An advantage to using the C library routines is that they've been better tested than your routines or mine. They're written by trained professionals (you know, the folks who brought us gets()!
). My personal preference is to use scanf/printf if I need floating point conversions, otherwise DIY. If you're running Linux, you can assume that libc is already in memory, and there is very little overhead (but non-zero) to use it. Your routines or mine might be "better" than what the library provides... but it isn't very likely...
I don't know what it means that the problem occurs only when called from a module other than the main one. Possibly a function of where "extern" is defined?
If all else fails, post the code... or a pared down example that shows the problem...
Best,
Frank