Older version (ie: one that comes with Visual Studio 6.0) of the Wincrypt.h header requires _WIN32_WINNT >= 0x0400, which is already defined by apr.h (apr.hw).
Created attachment 20069 [details] Older version of the Wincrypt.h header requires _WIN32_WINNT Build tested on older and newer (2003) platform SDK
Rev 421805 (2006/07/14) changed the sequence of imports in misc/win32/rand.c http://svn.apache.org/viewvc/apr/apr/trunk/misc/win32/rand.c?r1=170461&r2=421805 The change was mentioned in http://marc.info/?l=apr-dev&m=115285245603323&w=2. I'm guessing it is MinGW related since it mentioned librpcrt4.a. Xi Wang reported a compile failure related to this change in 2006-09-18: http://marc.info/?l=apr- dev&m=115856814824660&w=2. But the connection to the recent change did not seem to be made and there did not seem to be any follow through. I'm seeing the same compile failure on my pretty vanilla VC6 set up (no later platform SDK, etc) on Windows 2000. p.s. I have set up a MSYS+MinGW build environment and I can confirm the attached patch (which reverts rev 421805) does cause the MSYS+MinGW build to break, but fixing the VC6 build takes precedence. I plan to research it tomorrow (2007-05-02, US Central DT) and can hopefully come up with a solution that allows both to build.
Created attachment 20084 [details] Places wincrypt immediately after apr.h
Something in apr_private.h when preprocessed with the MinGW Windows headers effectively redefines WINADVAPI from __stdcall to empty which results in a link failure when wincrypt.h is placed after an include to apr_private.h. This patch has been tested both the VC6 (which failed with the current SVN HEAD) and MSYS+MinGW (which failed with the first patch). Have also successfully compiled with VS 2005.
Thanks for tracking this down. It seems related to this bug report: https://sourceforge.net/tracker/?func=detail&atid=302435&aid=1397036&group_id=2435
Committed to trunk as r551958. http://svn.apache.org/viewvc?view=rev&revision=551958
Backported as r551959. http://svn.apache.org/viewvc?view=rev&revision=551959