I spent a couple of hours to look on how to directly import native MS headers in PellesC.
The discrepancies are:
- standard headers for C99 and C11 compatibility
- Problems on Math due to C99 and C11 extensions
- An apparently misuse of pasting operators in driverspecs.h (called by winNT.h)
The first point to consider is that PellesC is
strictly compliant with C99 and C11, MS VC++ not! It includes C11++ that, unfortunately is not compatible with C11. In plane words the standard header layout is completely different from that of MS, things are declared in different stdxxxx.h files and this creates some problem.
The math type complex is a basic type for C99/C11, while MS defines it as a struct. This generates errors using the MS math.h header.
In driverspecs.h there are the lines:
#define __drv_out(annotes) __post __$drv_group(##__drv_nop(annotes))
and
#define __drv_when(cond, annotes) \
__drv_declspec("SAL_when(" SPECSTRINGIZE(cond) ")") __$drv_group(##__drv_nop(annotes))
Where the pasting operator (##) is not prepended by anything, and this is an error as stated also on MSDN help. This error produce a series of warnings of this type:
C:\PellesC\Include\winnt.h(1202): warning #1058: Invalid token produced by ##, from '(' and '__drv_nop'.
The problem can be easily solved by setting off the warning using a pragma, or by modifying the original MS def in driverspecs.h as follows:
#define __drv_out(annotes) __post __$drv_group(__drv_nop(annotes))
and
#define __drv_when(cond, annotes) \
__drv_declspec("SAL_when(" SPECSTRINGIZE(cond) ")") __$drv_group(__drv_nop(annotes))
Moreover in "shellapi.h" there is this line
// PATH = c:\windows\system32;C:\windows;c:\;C:\Program Files\Compilers\
which end with a backspace that triggers the warning:
C:\PellesC\Include\shellapi.h(666): warning #1063: Single-line comment contains escaped new-line.
To solve it edit shellapi.h adding a space at the end of the line.
Anyway to use the windows headers file is possible. They can live along with PellesC, and is possible to compile using directly the standard MS headers.
Now I will explain how to, of course there will be other problems that I still have not discovered compiling my sources.
I used the SDK WIN7 SP1.
To use Headers strictly follow the instructions
here.
Let me know what problems you encounter.