Ticket #2649 (closed defect: fixed)
CPLScanPointer doesn't do its job rightly when compiled in MSYS environment
| Reported by: | ajolma | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | ConfigBuild | Version: | unspecified |
| Severity: | normal | Keywords: | mingw |
| Cc: | mloskot, dron |
Description
CPLScanPointer uses
#if defined(WIN32) && defined(_MSC_VER)
to test whether to give sscanf a hex without the 0x prefix. The requirement is (probably) a feature of sscanf in msvcrt.dll. This does not work for MSYS, which does not define _MSC_VER. Instead MSYS (MinGW gcc?) defines MSVCRT to indicate that it will be using msvcrt.dll (and not msys-1.0.dll).
The question is now how to fix this. In this case the issue is the runtime that is used and not the compiler. If _MSC_VER checks for the compiler, then it shouldn't be used here. See similar discussion here: http://mail.gnome.org/archives/xml/2002-October/msg00002.html Maybe we should use MSVCRT every time the runtime is the issue and somewhere in configuration add
#ifdef _MSC_VER #define __MSVCRT__ #endif
