[Win32utils-devel] win32-api on Windows 7

Daniel Berger djberg96 at gmail.com
Sat Jan 30 11:10:50 EST 2010


On Fri, Jan 29, 2010 at 9:54 PM, Heesob Park <phasis at gmail.com> wrote:
> Hi,
>
> 2010/1/30 Daniel Berger <djberg96 at gmail.com>:
>> I just received and installed my copy of Windows 7 Ultimate. Pretty slick.
>>
>> I went with the 64 bit version. It seems to be what most people out
>> there have installed. Plus, I figured it would be the most
>> problematic, so I may as well get ready to deal with the potential
>> bugs.
>>
>> So far I've had 1 bug with sys-uname (already fixed).
>>
>> I decided to give win32-api a shot:
>>
>> win32/api.c:565: warning: cast to pointer from integer of different size
>>
>> default:
>>   rb_raise(cAPIProtoError, "Illegal prototype '%s'",
>>      RSTRING_PTR(a_proto[i])
>>   );
>>
>> I'm not sure I understand the warning in this case. Anything I need to
>> be worried about?
>>
> The real problem is that sizeof(long) != sizeof(void*) on Windows 64 bit.
> On Windows 64bit, data size is:
>
> sizeof(char) = 1
> sizeof(short) = 2
> sizeof(int) = 4
> sizeof(long) = 4
> sizeof(float) = 4
> sizeof(double) = 8
> sizeof(void*) = 8
> sizeof(size_t) = 8
>
> For detail, refer to http://msdn.microsoft.com/en-us/library/aa505945.aspx
>
> The whole win32utils assumed sizeof(long) = sizeof(void*) = 4.
> Thus, win32utils package is compatible with 32 bit.
> Another win64utils is required for 64 bit :)

Forgive me if I'm being dumb:

// gcc 3.4.5 on Win7
#include <stdio.h>

int main(){
  printf("Size of void* : %i\n", sizeof(void*)); // 4
  printf("Size of long: %i\n", sizeof(long)); // 4
  return 0;
}

They both show 4 for me.

Is there anything we can do to make win32-api work on 64 bit windows?

There is check_sizeof in mkmf.rb, if that helps at all.

Regards,

Dan


More information about the win32utils-devel mailing list