Developing a Windows driver without using Microsoft's compiler
My team has a C-language codebase that is used in several embedded systems of varying platforms. We have a group of people that are trying to port part of this codebase into a Windows driver. However, certain aspects of Microsoft's compiler don't jive with our existing code base (C99 features, among other things). We try to keep a common codebase between products and avoid creating forks for certain platforms, but the number of Windows-specific workarounds and #ifdefs
is getting messy.
Is there a way to build a Windows driver using a compiler other than Microsoft's? Our codebase compiles fine under gcc
and GreenHills, and we should be able to use the Intel C compiler on it as well (it's been a while since we've tried, but it should still work). Being able to use a different compiler would help keep our code cleaner, plus it would save us time and effort. All of the documentation that we have been able to locate refers to using either Visual Studio or the Windows DDK.
If the Microsoft compiler or DDK is indeed required, would it be possible to build the bulk of our code as a static library using another compiler and then use th开发者_Python百科e Windows DDK to create a wrapper around that library?
I wouldn't recommend such thing even if you succeed to compile. You can never know the side effects. The only compiler to be used is the one in WDK (it's incorporated into VS2012). Even the MS non-WDK compiler (any VS version prior to VS2012) not suitable here.
The same answer goes for building library with other compiler and linking it with MS one. It's not a question of "how to fool the OS" but rather "how to do the right thing". I suppose you can have a limited portion of code compiled with other compiler (e.g. compile code in C99 that is not supported by MS) but it's risky.
精彩评论