w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Including C++ headers in user mode programs built with NT DDK

Quick Answer

Abandon the idea of building user-mode components with DDK tools (although I find the concept fascinating :-P)

Your kernel mode component should be built separately from the user mode components as a matter of good practice.

Vague thoughts

Off the top of my head, and this really speaking from limited experience...there are a lot of subtle differences that can creep up if you try to mix the two together.

Using your own example of __cdecl vs __stdcall; You have two different calling conventions. _cdecl is all kernel stuff and all of the C++ methods are wrapped around in WINAPI (_stdcall) passing conventions and __stdcall will clean do auto stack clean up and expect frame pointers inserted all over the place. And if you by accident use compiler options to trigger a __fastcall, it would be a pain to debug.

You can definitely hack something together, but do you really want to keep track of that in your user-space code and build environment? UGH I say.

Unless you have very specific engineering reasons to mix the two environments, (and no a unified build experience is not a valid reason, because you can get that from a batch file called buildall.bat) I say use the separate toolchains.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.