开发者

File version information

How can I add version information to a fil开发者_运维知识库e? The files will typically be executables, .so and .a files.

Note: I'm using C++, dpkg-build and Ubuntu 8.10 if any of those have support for this.


For shared objects pass -Wl,soname,<soname> to gcc, or -soname <soname> to ld.

Executables and static libraries do not have version information per se, but you can add it to the filename if you like.


Linux executables do not have version information like Windows have...the only way I can think of doing it is to create a static character string, which would be expanded by a version control tracking system such as rcs, cvs, svn, git, in which a certain identifier is expanded based on the person who checked-in the code, here's the example of rcs identifiers that is used...

static char *Id = "$Id$";
static char *Author = "$Author$";

The above strings when checked into a revision control system, they get expanded next time it gets checked out...

static char *Id = "Foo, v1.1, 2009-02-18, 13:13";
static char *Author = "foo";

And use the utility 'ident' which runs on the binaries, 'ident' looks for Revision Control Systems (rcs) identifiers within a binary.

Hope this helps, Best regards, Tom.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜