On Monday 12 September 2005 22:30, Luis Rivera wrote: >>> package.C:384: error: `GetLongPathName' undeclared (first use of >>> this function)
>> Failed in compilation? Ouch! > Ouch! What's funny, though, is that it crashed exactly where a > GetLongPathName was called for, on a compiler meant to be roughly > equivalent to mingw... (mingw32 on cygwin) I think I've worked out why. Here's the appropriate bits of my J:/MinGW/include/winbase.h: ================================================================ ... #if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410) WINBASEAPI DWORD WINAPI GetLongPathNameA(LPCSTR,LPSTR,DWORD); WINBASEAPI DWORD WINAPI GetLongPathNameW(LPCWSTR,LPWSTR,DWORD); #endif ... #ifdef UNICODE ... #if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410) #define GetLongPathName GetLongPathNameW #endif ... #else ... #if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410) #define GetLongPathName GetLongPathNameA #endif ... #endif ================================================================ My version of J:/MinGW/include/windef.h contains this: ================================================================ #ifndef WINVER #define WINVER 0x0400 /* * If you need Win32 API features newer the Win95 and WinNT then you must * define WINVER before including windows.h or any other method of including * the windef.h header. */ #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT WINVER ================================================================ Which is why I have this little piece of magic defined in src/support/package.C.in: ================================================================ /* * MinGW's version of winver.h contains this comment: * * If you need Win32 API features newer the Win95 and WinNT then you must * define WINVER before including windows.h or any other method of including * the windef.h header. * * GetLongPathNameA requires WINVER == 0x0500. * * It doesn't matter if the Windows version is older than this because the * function will compile but will fail at run time. See * http://msdn.microsoft.com/library/en-us/mslu/winprog/microsoft_layer_for_unicode_apis_with_limited_support.asp */ # if defined(__MINGW32__) # define WINVER 0x0500 # endif ================================================================ It may be that we need to extend this final #if block to: # if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__CYGWIN32__) Or somesuch. Try it... Angus