different behavior of AMD64 compiler 14.00.40310.41 on Windows xp and 2k

Discussion in 'Windows 64bit' started by yezdived@gmail.com, Mar 8, 2006.

  1. Guest

    Hi All,
    I found Windows AMD64 compiler behaving differently When used on
    Windows XP SP2 and Windows 2K professional. (both using Windows 2003
    SP1 SDK - April edition)

    I've a .tlb which is imported in my .cpp file. This typelibrary has a
    structure defined inside and I'm using it in my code.

    XXX.cpp:

    #import COMLib.tlb
    using namespace COMLib;
    .....
    main()
    {
    COMLib::STRUCTDAT structData;
    }
    .....
    //

    When the project is compiled on XP SP2 with VS2003 IDE, the tlh code
    generated looks like follows:
    // Created by Microsoft (R) C/C++ Compiler Version 14.00.40310.41
    (cda64a29).
    //...
    #pragma once
    #pragma pack(push, 8)
    namespace COMLib {
    .....
    .....
    #pragma pack(push, 4) //////Here is the difference, on WIN2k, this
    value is 8.
    struct STRUCTDAT
    {
    unsigned long ValidationDataLength;
    unsigned char * ValidationData;
    };
    #pragma pack(pop)
    .....
    .....
    }
    #pragma pack(pop)

    While on Win2k the same project under same environment the tlh
    generated looks like

    // Created by Microsoft (R) C/C++ Compiler Version 14.00.40310.41
    (b739b039).
    //...
    #pragma once
    #pragma pack(push, 8)
    namespace COMLib {
    .....
    .....
    #pragma pack(push, 8) //////Here is the difference, on WINXP, this
    value is 4.
    struct STRUCTDAT
    {
    unsigned long ValidationDataLength;
    unsigned char * ValidationData;
    };
    #pragma pack(pop)
    .....
    .....
    }
    #pragma pack(pop)


    Because of the wrong alignment on XP, sample built here fails while
    built on Win2K succeeds. Does anyone know why compiler is behaving
    this way? How to make it build correctly on WinXP?
     
    , Mar 8, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Disillusioned_01

    Invalid c# Compiler Behaviour !?

    Disillusioned_01, May 28, 2004, in forum: MCSD
    Replies:
    12
    Views:
    1,167
    The Poster Formerly Known as Kline Sphere
    May 29, 2004
  2. aguy
    Replies:
    4
    Views:
    538
  3. =?Utf-8?B?a2g=?=
    Replies:
    48
    Views:
    1,471
  4. dileepd
    Replies:
    0
    Views:
    1,055
    dileepd
    Jul 18, 2007
  5. staticy2003
    Replies:
    0
    Views:
    896
    staticy2003
    Feb 24, 2008
Loading...

Share This Page