[ILUG] Confirming versions
Justin Mason
jm at jmason.org
Thu Dec 14 11:44:49 GMT 2000
Kenn Humborg said:
> > I am trying to find a way to identify object files so that I can check
> > that all the objects in one archive(library) have the same version.
> > I have looked at using the rcsid tags and ident put these get stripped
> > out by the compiler when I use any level of optimisation. Is there any
> > way of doing this automatically, and it must be portable so #pragma's
> > is not the way to go.
>
> Instead of declaring the string as static (which is convenient because
> you can use the same variable name for each string), use a different
> name (to keep the linker happy) and remove the static (forces compiler
> to emit the string in the .o, because it can't know if it is used by
> other .o files):
Another way is to implement a get_version_string() method or function, or
print them out as part of a usage message etc. That will avoid the
compiler stripping them. It is handy for debugging, too.
--j.
More information about the ILUG
mailing list