[ILUG] Confirming versions

Kenn Humborg kenn at linux.ie
Thu Dec 14 00:27:19 GMT 2000


On Wed, Dec 13, 2000 at 03:39:24PM -0800, Mark Fallon wrote:
> Hi,
> 
> 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):

------  foo.c  ------
const char foo_ver[] = "@(#) $Id";

------  bar.c  ------
const char bar_ver[] = "@(#) $Id";

Later,
Kenn





More information about the ILUG mailing list