I downloaded a library (NAG c libraries to be precise) and both the static and dynamic versions of the library have the same name (libnagc_nag). At the beginning I was having troubles because I was trying to link to the static version in OS X and by default it uses the dynamic library, so I changed the name of the files to distinguish between them (libnagc_nag_s.a and libnagc_nag_d.dylib for OS X and libnagc_nag_d.so in linux). my question is: Is giving them the same name to both a common practice? Even if so, Is there any problem or disadvantage on changing their names in this way?
Yes, it's the convention to have
libNAME.a
and
libNAME.so.VERS
with the .a being the static archive. Why do you want to add a static library in to your program, though? You'll encounter maintenance difficulties down the track if you do so.
Adding -lnagc_nag_d
to your LDFLAGS
in the Makefile should be sufficient to get the dynamic library linked in.