Hello Redirect,

Sunday, October 18, 2009, 1:14:20 AM, you wrote:

RSN> Yeah. The problem here is that HANDLE is typedef'd as void* (in
RSN> winnt.h), whereas _get_osfhandle() returns a long
RSN> (http://msdn.microsoft.com/en-us/library/ks2530z6.aspx), and gcc
RSN> insists on returning a warning when casting a 32 bit long into a
RSN> 64 bit pointer ("cast to pointer from integer of different size").
RSN> The most elegant way I found to avoid that warning is to do an arithmetic 
operation first.

RSN> Of course one has to wonder why a function that is meant to
RSN> return a handle does not actually return a type HANDLE...

RSN> The only other way I see to do it is to add idefs for MINGW64 so
RSN> that we cast _get_osfhandle() to a long long first.

Actually, in VC9 it returns intptr_t (MSDN is wrong here):

_CRTIMP intptr_t __cdecl _get_osfhandle(_In_ int _FileHandle);
(from io.h)

So it might be worth it to get mingw people to fix their headers...

-- 
WBR,
 Igor                            mailto:[email protected]

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to