Am 02.06.22 um 21:06 schrieb Janne Blomqvist: > On Wed, Jun 1, 2022 at 1:16 PM Kay Diederichs > wrote: >> If -g is used, the executable _always_ has version and option info > > Well, isn't that the answer to your question then? > > As an alternative approach, make a command-line option (say, "-v") > that prints the version number of the program, name of the author and > other pertinent information, as well as the output of > compiler_version() and compiler_options(), and then exits. That would > ensure that those calls won't be optimized away. > I was thinking of such a -v option as well, and it is a solution for some situations, but not e.g. for a dynamically loadable library (see https://cims.nyu.edu/~donev/Fortran/DLL/DLL.Forum.txt ) which is my situation ( https://strucbio.biologie.uni-konstanz.de/xdswiki/index.php/LIB ). I'd like to be able to see later which compiler version and options were used when compiling that library, because over the years of distributing this code, compilers and options have been changing. -g includes the source code, which is not always desired, and is not possible here due to license issues - there was no concept of "open source" as we have it today in the 80ies when this code was started. Also I think it makes the code slower. Using strings | grep GCC I get meaningful output when e.g. -O2 is used as compiler option, but not for other options. I don't understand it yet which is why I wish there were a dedicated compiler option for including the compilation line in the binary (like -sox for ifort). Best, Kay -- Kay Diederichs http://strucbio.biologie.uni-konstanz.de email: Kay.Diederichs@uni-konstanz.de Tel +49 7531 88 4049 Fachbereich Biologie, Universität Konstanz, Box M647, D-78457 Konstanz This e-mail is digitally signed. If your e-mail client does not have the necessary capabilities, just ignore the attached signature "smime.p7s".