0

I'm compiling source code from the command line using VS2012 ARM Cross Tools Command Prompt. I found I needed to add _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE to get the project to begin compiling.

A number of files compile cleanly. For example:

        cl /Fotmp32dll\fips_drbg_selftest.obj  -Iinc32 -Itmp32dll /MD /Ox /O2 /O
b2 -DOPENSSL_FIPSCANISTER -DOPENSSL_THREADS  -DDSO_WIN32  -D_ARM_WINAPI_PARTITIO
N_DESKTOP_SDK_AVAILABLE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_
MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_FIPS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGI
NE /Zi /Fdtmp32dll/lib -D_WINDLL  -c .\fips\rand\fips_drbg_selftest.c
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60315.1 for ARM
Copyright (C) Microsoft Corporation.  All rights reserved.

fips_drbg_selftest.c
        cl /Fotmp32dll\fips_drbg_rand.obj  -Iinc32 -Itmp32dll /MD /Ox /O2 /Ob2 -
DOPENSSL_FIPSCANISTER -DOPENSSL_THREADS  -DDSO_WIN32  -D_ARM_WINAPI_PARTITION_DE
SKTOP_SDK_AVAILABLE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2
-DOPENSSL_NO_KRB5 -DOPENSSL_FIPS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE /
Zi /Fdtmp32dll/lib -D_WINDLL  -c .\fips\rand\fips_drbg_rand.c
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60315.1 for ARM
...

Now I'm running into a macro redefinition problem (after about 25 files have been compiled):

C:\Program Files (x86)\Windows Kits\8.0\include\shared\ws2def.h(96) : warning C4
005: 'AF_IPX' : macro redefinition
        C:\Program Files (x86)\Windows Kits\8.0\include\um\winsock.h(452) : see
previous definition of 'AF_IPX'

C:\Program Files (x86)\Windows Kits\8.0\include\shared\ws2def.h(136) : warning C
4005: 'AF_MAX' : macro redefinition
        C:\Program Files (x86)\Windows Kits\8.0\include\um\winsock.h(471) : see
previous definition of 'AF_MAX'
...
C:\Program Files (x86)\Windows Kits\8.0\include\shared\ws2def.h(217) : error C20
11: 'sockaddr' : 'struct' type redefinition
        C:\Program Files (x86)\Windows Kits\8.0\include\um\winsock.h(477) : see
declaration of 'sockaddr'
...

I see that the INCLUDE envar has both include\shared and include\um paths:

INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Progra
m Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\INCLUDE;C:\Program Files (x
86)\Windows Kits\8.0\include\shared;C:\Program Files (x86)\Windows Kits\8.0\incl
ude\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt;

When I look at the difference, the Warnings are minor:

// shared/windosck.h
#define AF_IPX          6               /* IPX and SPX */
#define AF_NS           6               /* XEROX NS protocols */
// um/ws2def.h
#define AF_NS           6               // XEROX NS protocols
#define AF_IPX          AF_NS           // IPX protocols: IPX, SPX, etc.

But the Errors have major differences:

// shared/ws2def.h:
typedef struct sockaddr {

#if (_WIN32_WINNT < 0x0600)
    u_short sa_family;
#else
    ADDRESS_FAMILY sa_family;           // Address family.
#endif //(_WIN32_WINNT < 0x0600)

    CHAR sa_data[14];                   // Up to 14 bytes of direct address.
} SOCKADDR, *PSOCKADDR, FAR *LPSOCKADDR;

// um/winsock.h
struct sockaddr_in {
        short   sin_family;
        u_short sin_port;
        struct  in_addr sin_addr;
        char    sin_zero[8];
};

What is the difference between include\shared and include\um?

jww
  • 97,681
  • 90
  • 411
  • 885
  • Presumably there are different headers in the two directories. For some reason, your code is trying to `#include` an incompatible combination. – Carl Norum Jul 29 '13 at 21:25
  • Thanks Carl. What is 'UM'? I'm kind of used to headers being in one place (give or take). – jww Jul 30 '13 at 01:12
  • From the comments in the headers, I'm guessing 'UM' is user mode: "This file contains the core definitions for the Winsock2 specification that can be used by both user-mode and kernel mode modules." – jww Jul 30 '13 at 01:36

0 Answers0