#28 64-bit windows compatibility (mingw64)

open
spadix
None
5
2014-08-13
2012-04-02
Piotr Sobiech
No

A patch that introduces Windows 64-bit compatibility (using MINGW64).

Changes:
* Replaced long with ptrdiff_t for pointer arithmetic in zbar_decoder_reset (ptrdiff_t can always hold the target's system pointer operations result, and is compatible with size_t from memset) (http://www.gnu.org/software/libc/manual/html_node/Important-Data-Types.html)
* Fixed SetWindowLongPtr and SetWindowLongPtr, by replacing GWL_USERDATA with GWLP_USERDATA (http://msdn.microsoft.com/en-us/library/windows/desktop/ms644898(v=vs.85).aspx). Not sure why GWL_USERDATA worked for 32-bit mingw, maybe some backward compatibility hack in mingw32?
* Passed the zbar window class name as string to CreateWindowEx, because passing (casting) the "ATOM" no longer worked for mingw64. Maybe there is some more bright way to fix it, i don't know. (http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680(v=vs.85).aspx)

Possible gotchas:
* _WIN32_WINNT is hardcoded in Mingw64 as 0x0502, so redefinition in configure.ac is commented out for mingw64 compilation. It's not a big deal, because (not including Windows XP 64-bit, which was a bit buggy and not widely used, and windows 2000 that had only 64-bit version for the Itanium processor) Win2k3 (the first implementing 0x0502 API) is the first 64 bit Windows that had 64bit version.

Tested on:
* Linux 32bit and 64bit
* Windows 2k3 32bit
* Windows 2k8 RC2 64bit

Compilation tested on (gcc --version):
gcc (GCC) 4.6.3
i486-mingw32-gcc (GCC) 4.6.2
x86_64-w64-mingw32-gcc (GCC) 4.5.4 20110822 (prerelease)

Discussion

  • Piotr Sobiech
    Piotr Sobiech
    2012-04-02

    MINGW64 compatibility patch

     
    Attachments
  • Piotr Sobiech
    Piotr Sobiech
    2012-04-02

    • assigned_to: nobody --> spadix
    • status: open --> pending
     
  • Piotr Sobiech
    Piotr Sobiech
    2012-04-02

    • status: pending --> open