Re: Question on multiple compiler environment



beliavsky@xxxxxxx wrote:
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

If Windows has anything like make you could have a make target for the
main program something like (not tested, probably I forgot some detail
about make syntax):

main.o:main.f90
echo "character(len=*) :: compvers = 'compiled with `$(FC) -V` on `date`" >compvers.inc
$(FC) $(FCFLAGS) $<

I.e. before you compile the main program you store the output from
the compiler version command in an include file, and the in the main
program you include said file.

Or something like that.

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?

In RCS/CVS, you have "variables" like "$Id$" which get expanded to
"$Id: filename revision author etc.$" when committing the file to the
repository. See the co(1) man page for the different keywords you can
use.

So just have something like

character(len=*) :: version = "$Id$"

in your source file.

I'm not sure if more modern version control systems like subversion
have similar keyword expansion features. Wouldn't surprise me.

--
Janne Blomqvist
.



Relevant Pages

  • Re: COBOL Compiler for Windows
    ... setting Windows Compatibility mode to NT? ... The package is aimed at any platform that runs CICS, ... So the V2.2 compiler I have performs two functions, ... executables for the online Cobol/CICS pgms that my software generates. ...
    (comp.lang.cobol)
  • Re: Difference between Portable Executable (PE) file and a Assembl
    ... > I assume that JIT compiler and Ilasm.exe convert the IL code into machine ... >> format used to define 32bit Windows Executables. ... >>> in the portable executable file format. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Difference between Portable Executable (PE) file and a Assembl
    ... >I assume that JIT compiler and Ilasm.exe convert the IL code into machine ... >> format used to define 32bit Windows Executables. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Difference between Portable Executable (PE) file and a Assembl
    ... >>I assume that JIT compiler and Ilasm.exe convert the IL code into machine ... >>> format used to define 32bit Windows Executables. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: hmm..interesting
    ... you've got a discussion of ARM vs Intel architecture here: ... And ARM is rapidly running away from RISC. ... mainstream (many netbooks and smartphones run Linux instead of Windows ... And hardly any C compiler does. ...
    (comp.sys.acorn.hardware)

Loading