Hi Andy.

I was under the impression that MinGW and Cygwin both natively defined WIN32 like MSVC. I just did a quick check, and only MinGW defines it. I tried modifying configure.in so -DWIN32 is added to the CFLAGS when Cygwin is detected, but then the compile stops with:

../include/net-snmp/library/snmp_alarm.h:17: error: field `t' has incomplete type

Also, while modifying system_mib.c so that the windowsOSVersionString function would be compiled under all three Win32 platforms, I found that it would not compile under Cygwin. After adding the following to system_mib.c, it compiled fine:

#ifdef cygwin
#include <windows.h>
#endif

I noticed that the mibII_common.h file defines WIN32 at the bottom if cygwin is detected, but this file was not included in system_mib.c. Including it didn't even seem to help. I can add the above in as a quick fix, but I wonder if it should really be #ifdef WIN32..

I was going to add a section to README.WIN32 that lists the defines that are used with the three supported Windows build systems. Here is what I was planning on adding:

***
Define:                    Description:
-------                    ------------

WIN32                      Defined by MSVC, MinGW and Cygwin

MSVC                       Defined by MSVC only

mingw32                    Defined by MinGW only

cygwin                     Defined by Cygwin only

HAVE_WIN32_PLATFORM_SDK    Should be defined if the Microsoft Platform SDK
                           is installed and registered with MSVC or enabled
                           for MinGW or Cygwin

Note:  MinGW and Cygwin do not require the Platform SDK as they both
       contain most if not all of the functionality provided by the PSDK.
       When adding code that requires the PSDK under MSVC, the following
       can usually be used:

#if defined (HAVE_WIN32_PLATFORM_SDK) || defined (mingw32) || defined (cygwin)
***


Based on my findings above, the notes about Cygwin defining WIN32 are incorrect. I think it makes sense that WIN32 would cover ALL Windows platforms, while MSVC, mingw32 and cygwin could be specific to each build system. You mentioned before: "Keeping Cygwin separate in most cases still makes sense because a lot of POSIX code will compile out of the box with Cygwin". I agree with this, but having WIN32 only defined for MSVC and MinGW but not Cygwin is kind of strange.

What do you think?

Alex


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to