Skip to content

Instantly share code, notes, and snippets.

@jonforums
Last active December 17, 2015 07:08
Show Gist options
  • Save jonforums/5570163 to your computer and use it in GitHub Desktop.
Save jonforums/5570163 to your computer and use it in GitHub Desktop.
mingw.org, mingw-w64, and winsdk handling of NET_LUID struct
C:\Users\Jon\Documents\CDev\sandbox>cl -W3 -Fenetluid.exe net_luid_test.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
net_luid_test.c
net_luid_test.c(22) : warning C4101: 'luid' : unreferenced local variable
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:netluid.exe
net_luid_test.obj
C:\Users\Jon\Documents\CDev\sandbox>gcc --version
gcc (GCC) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\Jon\Documents\CDev\sandbox>gcc -Wall -o netluid.exe net_luid_test.c
net_luid_test.c: In function 'main':
net_luid_test.c:22:23: warning: unused variable 'luid' [-Wunused-variable]
C:\Users\Jon\Documents\CDev\sandbox>gcc --version
gcc (rubenvb-4.7.2-release) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\Jon\Documents\CDev\sandbox>gcc -Wall -o netluid.exe net_luid_test.c
net_luid_test.c:18:3: error: conflicting types for 'NET_LUID'
In file included from c:\devkit-4.7.2\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/iptypes.h:14:0,
from c:\devkit-4.7.2\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/iphlpapi.h:15,
from net_luid_test.c:3:
c:\devkit-4.7.2\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/ifdef.h:94:3: note: previous declaration of 'NET_LUID' was here
net_luid_test.c: In function 'main':
net_luid_test.c:22:23: warning: unused variable 'luid' [-Wunused-variable]
C:\Users\Jon\Documents\CDev\sandbox>gcc --version
gcc (rev2, Built by MinGW-builds project) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\Jon\Documents\CDev\sandbox>gcc -Wall -o netluid.exe net_luid_test.c
net_luid_test.c:18:3: error: conflicting types for 'NET_LUID'
} NET_LUID;
^
In file included from c:\devkit-mb4.8.0\mingw\i686-w64-mingw32\include\iptypes.h:14:0,
from c:\devkit-mb4.8.0\mingw\i686-w64-mingw32\include\iphlpapi.h:15,
from net_luid_test.c:3:
c:\devkit-mb4.8.0\mingw\i686-w64-mingw32\include\ifdef.h:94:3: note: previous declaration
of 'NET_LUID' was here
} NET_LUID, *PNET_LUID;
^
net_luid_test.c: In function 'main':
net_luid_test.c:22:23: warning: unused variable 'luid' [-Wunused-variable]
int main() { NET_LUID luid; return 0; }
^
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <stdint.h>
/*
* mingw-w64: include guard is _INC_IFDEF so this should fail the build
*/
#ifndef _IFDEF_
typedef struct {
uint64_t Value;
struct {
uint64_t Reserved :24;
uint64_t NetLuidIndex :24;
uint64_t IfType :16;
} Info;
} NET_LUID;
#endif
int main() { NET_LUID luid; return 0; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment