Microsoft Visual Studio's linker has a /DRIVER
flag specifically for building drivers:
Use the
/DRIVER
linker option to build a Windows NT kernel mode driver.
However, Microsoft says:
You must not build drivers by using the compiler or linker that Microsoft Visual Studio provides.
which begs the question:
Why should I not compile/link drivers with Visual Studio?
Is the output generated by the DDK/WDK tools different from that generated by Visual Studio?
If so, how is it different?Edit:
Notice that I'm talking about using Visual Studio's compiler and linker, not libraries!
I use the WDK headers and libraries with VS's comp开发者_StackOverflowilers and linkers, but Microsoft specifically says that I need to avoid this:
You must not build drivers by using the compiler or linker that Microsoft Visual Studio provides.
They didn't even mention headers and libraries, so of course that's not my question.
Why?
This article put me on the right track, I think. That's because the DDK tools use different runtime libraries than Visual Studio.
Visual Studio will link the driver with the runtime libraries it provides (or optionally, the latest version of the runtime installed on the system), but a driver should arguably be linked with the exact same runtime used to build the operating system itself.
精彩评论