Same code build twice => diff binary

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Viviana Vc

    #1

    Same code build twice => diff binary

    Hi all,

    I am using Win2k, VS. NET 7.1 (MS development Environment 2003 7.1.3088)
    and I noticed that by building the exact same code twice the generated
    binaries are different (not much, but they are). To be sure I tried a
    simple console application like void main(){} and 2 times rebuilding the
    project gets 2 different binaries.

    Has anybody any clue why this happens?
    Could I somehow change a setting or something to remove those diff (I
    mean from the same code to get identical binaries)?

    Thanks in advance,
    Viv
  • Allan Bruce

    #2
    Re: Same code build twice => diff binary


    "Viviana Vc" <vcotirlea@hotm ail.com> wrote in message
    news:2idu3bFlvg crU1@uni-berlin.de...[color=blue]
    > Hi all,
    >
    > I am using Win2k, VS. NET 7.1 (MS development Environment 2003 7.1.3088)
    > and I noticed that by building the exact same code twice the generated
    > binaries are different (not much, but they are). To be sure I tried a
    > simple console application like void main(){} and 2 times rebuilding the
    > project gets 2 different binaries.
    >
    > Has anybody any clue why this happens?
    > Could I somehow change a setting or something to remove those diff (I
    > mean from the same code to get identical binaries)?
    >
    > Thanks in advance,
    > Viv[/color]

    void main(){} is undefined bahaviour therefore the compiler is free to do
    what it wants. Vey unlikely this is the cause however. I am not sure about
    the format of an exe, but could it be the timestamps that are causing them
    to be different?
    Allan


    Comment

    • Viviana Vc

      #3
      Re: Same code build twice =&gt; diff binary

      I found the following article:

      which tells that indeed the timestamp is the diff, but I couldn't find
      in VC++ IDE any setting to disable the timepstamp stuff, and I assume
      this should be somehow doable.

      Thx,
      Viv

      On Sat, 05 Jun 2004 14:55:45 +0200, Viviana Vc <vcotirlea@hotm ail.com>
      wrote :
      [color=blue]
      >Hi all,
      >
      >I am using Win2k, VS. NET 7.1 (MS development Environment 2003 7.1.3088)
      >and I noticed that by building the exact same code twice the generated
      >binaries are different (not much, but they are). To be sure I tried a
      >simple console application like void main(){} and 2 times rebuilding the
      >project gets 2 different binaries.
      >
      >Has anybody any clue why this happens?
      >Could I somehow change a setting or something to remove those diff (I
      >mean from the same code to get identical binaries)?
      >
      >Thanks in advance,
      >Viv[/color]

      Comment

      • AlexS

        #4
        Re: Same code build twice =&gt; diff binary

        Hi, Viviana

        depending on settings you can get different timestamps and versions in
        binaries. Which will cause different hashes and some other fields - don't
        remember now exactly wich ones. If you are really interested - check PE
        format description for .Net assemblies on MSDN.

        HTH
        Alex

        "Viviana Vc" <vcotirlea@hotm ail.com> wrote in message
        news:2idu3bFlvg crU1@uni-berlin.de...[color=blue]
        > Hi all,
        >
        > I am using Win2k, VS. NET 7.1 (MS development Environment 2003 7.1.3088)
        > and I noticed that by building the exact same code twice the generated
        > binaries are different (not much, but they are). To be sure I tried a
        > simple console application like void main(){} and 2 times rebuilding the
        > project gets 2 different binaries.
        >
        > Has anybody any clue why this happens?
        > Could I somehow change a setting or something to remove those diff (I
        > mean from the same code to get identical binaries)?
        >
        > Thanks in advance,
        > Viv[/color]


        Comment

        • Jochen Kalmbach

          #5
          Re: Same code build twice =&gt; diff binary

          Viviana Vc wrote:
          [color=blue]
          > I am using Win2k, VS. NET 7.1 (MS development Environment 2003
          > 7.1.3088) and I noticed that by building the exact same code twice the
          > generated binaries are different (not much, but they are). To be sure
          > I tried a simple console application like void main(){} and 2 times
          > rebuilding the project gets 2 different binaries.
          >
          > Has anybody any clue why this happens?[/color]

          At least the time-stamp is different.


          [color=blue]
          > Could I somehow change a setting or something to remove those diff (I
          > mean from the same code to get identical binaries)?[/color]

          In general: No. You can change the timestamp "by hand".


          For more info see:
          Microsoft Portable Executable and Common Object File Format
          Specification
          http://www.microsoft.com/whdc/system...re/PECOFF.mspx


          It was already discussed several times in some newsgroups; see for
          example:



          --
          Greetings
          Jochen

          Do you need a memory-leak finder ?


          Do you need daily reports from your server?
          http://sourceforge.net/projects/srvreport/

          Comment

          Working...