2012-03-06 09:01:02 PST
I have faced this problem compiling NetCDF library: even with the -m64 flag "long" is 32 bit.
Here is the official "-m64" flag description: "The -m64 option sets int to 32 bits and long and pointer types to 64 bits,
and generates code for the x86-64 architecture."
Source:
http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options
What I see is presumably a bug: long is still 32 bit, only long long is 64 bit. Below is the illustration, copied form a console:
H:\bug>dir /b
sizeof-test.cpp
H:\bug>type sizeof-test.cpp
#include <stdio.h>
int main() {
printf("sizeof(long) = %d, sizeof(long long) = %d.\n", sizeof(long), sizeof(long long));
return 0;
}
H:\bug>x86_64-w64-mingw32-gcc.exe -m64 sizeof-test.cpp -o sizeof-test.exe
H:\bug>sizeof-test.exe
sizeof(long) = 4, sizeof(long long) = 8.
H:\bug>dir /b
sizeof-test.cpp
sizeof-test.exe
I am using the most recent distribution mingw-w64-bin_i686-mingw_20111220.zip. Another one I tried mingw-w64-bin_x86_64-mingw_20111101_sezero.zip has the same problem.
Any comments?
Thanks,
nik-nik-nik