pristo wrote On 11/08/05 11:36,:
> hello All,
> how can i insert unique ID into binary file (that created by compiler)?
> (so after compiling i can to identify the src that i use)
In portable C, the closest you can come is to create
a static variable initialized with the ID you desire. The
source file name, date, and time are often used for this:
static const char version_info[] =
"@@@ VERSION INFO @@@"
" Compiled from " __FILE__
" on " __DATE__
" at " __TIME__;
Many systems have utilities that can extract and display
the string constants from an executable or object file,
and ways to separate the "@@@ VERSION INFO @@@" strings
from the others (on Unix systems, you could use `strings'
and `grep'). Some source-management systems can be made
to provide part or all of the data, which could automate
the inclusion of a version identifier for each file. Of
course, all such utilities are not part of the C language,
and will vary from system to system.
A disadvantage of this technique is that some compilers
will issue diagnostic messages about variables that are
declared but not used; such compilers are likely to complain
about the `version_info' variable.
--