The #pragma comment directive places a comment string into the target or object file.
where suboptions do the following:
compiler The name and version of the compiler is appended to the end of the generated object module. date The date and time of compilation is appended to the end of the generated object module. timestamp The date and time of the last modification of the source is appended to the end of the generated object module. copyright The text specified by the token_sequence is placed by the compiler into the generated object module and is loaded into memory when the program is run. user The text specified by the token_sequence is placed by the compiler into the generated object but is not loaded into memory when the program is run.
Assume that following program code is compiled to produce output file a.out:
#pragma comment(date) #pragma comment(compiler) #pragma comment(timestamp) #pragma comment(copyright,"My copyright") int main() { return 0; }
You can use the operating system strings command to look for these and other strings in an object or binary file. Issuing the command:
strings a.out
will cause the comment information embedded in a.out to be displayed, along with any other strings that may be found in a.out. For example, assuming the program code shown above:
Mon Mar 1 10:28:09 2004 XL C/C++ for Linux Compiler Version 7.0 Mon Mar 1 10:28:13 2004 My copyright