开发者

How to change version information of *.a files after compilation

开发者 https://www.devze.com 2022-12-21 03:31 出处:网络
I would like to know what is the way (if it is possible at all), to change the version information of a *.a files in Unix after the compilation.

I would like to know what is the way (if it is possible at all), to change the version information of a *.a files in Unix after the compilation. I know how to do it for Dll files in windows - but have no idea how to manage with it in Unix.

Thank you all!开发者_如何学C


Static libraries are just archives of .o files - they don't embed version themselves unless your code somehow publishes a symbol that holds version information.

Like:

int libFoo_version = 0x01000000;

Or you could use

char* libFoo_version = "1.0";

and afterwards use something like the strings libFoo.a | grep libFoo_version command in combination with sed to alter the version information.

Yet another option is to embed an empty file in the archive which name contains the version information. YMMV


Static libraries don't have version information per se.


If the version is part of the source code (for example, a string constant), then you can simply use sed to change it if the new version has the same length as the old one.

0

精彩评论

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