Re: Question on multiple compiler environment



Matthias Möller wrote:
Most compilers, especially the ones under UNIX/Linux, have
options like -v, -V or --version to print the version number to the
screen/standard output. You will then have to analyse that output.

Yes I know but nevertheless thank you for your answer. But this requires
to write some kind of script which extracts the version number from the
console output.

1. the "layout" of the console output differs from one compiler to another.

2. the "layout" may differ from one version to the other.

As a consequence, the scripts must be adapted each time a new version is
available. Isn't there a more elegant way to determine the version number?

I do not think so. The Fortran standard says nothing about such
details, which therefore differ across compilers. Regarding point 2
above, I do not think the layout changes often, so I would write a
script to handle the current layout and do some error checking to
detect changes in version numbers.

I'd like to ask a related question. How does one embed the version
number of a compiler in executables generated by it? For my program
foo.exe on Windows I would like

foo.exe -v

to say something like

"compiled with gcc version 4.0.3 (g95 0.91!) Sep 19 2006"

I have also wondered how to embed information about the source code in
the executable. Currently I define a parameter NVERSION in my main
program and have a line at the beginning

write (*,*) "version #",NVERSION

This method relies on my changing NVERSION manually and on saving old
source codes. I know there exist source control systems such as RCS,
but can one use them to automatically embed version information in an
executable?

.



Relevant Pages

  • Re: code problem
    ... But then it doesn't really depend on the layout. ... executables produced by the same compiler (if not even the ... If the compiler had reordered the fields, ... Kasper Dupont ...
    (comp.os.linux.development.system)
  • Re: VS.NET against JAVA
    ... Java's layout managers take a while to get used to, ... Java wins hands down IMO. ... The JIT compiler is a compiler :-) ... Well, I think it already does a fair amount of optimisation, but I'm ...
    (microsoft.public.dotnet.general)
  • Re: Layout Hell.
    ... "When you guys ask what compiler is used.. ... the conversion" solution - was a responsive solution. ... "Robert Wagner" wrote in message ... >>>>I am new to the layout scene, but if I could see some real examples, I ...
    (comp.lang.cobol)
  • Re: Direct access and derived types.
    ... cause the code to break with a new version of the compiler or different ... portable' layout of derived types? ... might give you more control of the options than Fortran does, ... expect them to work without padding. ...
    (comp.lang.fortran)
  • Re: Right way of passing unmanaged structures between managed and native code?
    ... not is guaranteed to use the same layout for native structs/classes. ... There's no guarantee that any other vendor's compiler ...
    (microsoft.public.dotnet.languages.vc)