Announcement

Collapse
No announcement yet.

My 64-bit programming experience

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • My 64-bit programming experience

    Since i am now programming in both 32 and 64-bit, there is something i would like to share with you about 64-bit.

    While most of the common API structure TYPE are still the same in 64-bit, a few are using 8-byte alignment rather than 4-byte, causing major havoc if you are not aware of this.

    While this is not a problem for those using C or C++, this could be much of an issue if ever there is a 64-bit version of PowerBASIC.

    Let's take an example :

    The BITMAP structure is using a size of 28-byte in 32-bit, but a size of 32-byte in 64.
    This has a direct impact on the bm.bmBits pointer, especially when dealing with the GetObjectA API.
    So always use first GetObjectA with a null pointer to retrieve the correct size to use, or your code won't work anymore and you will not understand why.

    Patrice Terrier
    www.zapsolution.com
    www.objreader.com
    Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

  • #2
    Thank you Patrice!

    Comment


    • #3
      Aslan

      Here is the TYPE i am using for BITMAP in 64-bit mode with another langage

      Code:
      BITMAP64 is structure
      	bmType is int          //Type C : LONG
      	bmWidth is int         //Type C : LONG
      	bmHeight is int        //Type C : LONG
      	bmWidthBytes is int    //Type C : LONG
      	bmPlanes is 2-byte int //Type C : WORD
      	bmBitsPixel is 2-byte int //Type C : WORD
      	[COLOR="Red"][B]dummy is int[/B][/COLOR]           //add 4-byte for correct alignment in 64-bit
      	bmBits is system int   //Type C : LPVOID
      END
      Last edited by Patrice Terrier; 26 May 2014, 02:06 AM.
      Patrice Terrier
      www.zapsolution.com
      www.objreader.com
      Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

      Comment


      • #4
        Isn't there some alignment/fill directive you can specify on the TYPE line?

        Not that it matters with no PB/64 but I have to belive those interested in "someday" using a PB/64 would not box themselves in, opting to code something like..
        Code:
        #IF %SIXTY_FOUR
            TYPE BITMAP   alignment/fill option for 64
        #ELSE
            TYPE BITMAP    32-bit values for same
        #ENDIF
            member  
            member  
        END TYPE 
        #ENDIF
        Ready to move when you are!

        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          interesting read
          https://docs.microsoft.com/en-us/pre...ectedfrom=MSDN

          Comment

          Working...
          X