Why is it "Bad" to Build Drivers with Visual Studio? - visual-studio

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 compilers 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.

Related

OneAPI: Possible to statically link libraries with DPC++/OneAPI for Visual Studio?

I've just installed the Intel compiler for Visual Studio. Under the DPC++ project settings->Code Generation the only option is Multi-Threaded DLL.
Searching high and low on the internet yielded no information.
Does this toolset only support dynamic linking?
Yes, that is the only option present as of now in Visual Studio IDE. Please find the below link:
https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-reference/compiler-options/linking-or-linker-options/ld.html

Visual Studio 2019 install MFC library?

I am inheriting a C++ code base on Windows in Visual Studio 2019 and I'm trying to compile the code, but it seems like VS cannot find the header files in the MFC library, e.g. "afxdialogex.h". I couldn't find any sources on the internet on how to install MFC and it seems like it should come with Visual Studio. Any ideas?
Disclaimer: I have zero Windows experience as I have exclusive used *nix systems until now.
As documented:
In Visual Studio 2017 and later, MFC and ATL are optional sub-components under the Desktop development with C++ workload in the Visual Studio Installer program. You can install ATL support without MFC, or combined MFC and ATL support (MFC depends on ATL). For more information about workloads and components, see Install Visual Studio.
You can either select MFC when choosing workloads (on the right-hand side), or choose individual components.

What CUDA version for VS2017 and GTX 870M?

I want to develop a program using CUDA but I am getting lost by install instructions on NVidia's site.
So here is what I have:
Windows 10 laptop with a NVidia GPU GeForce GTX 870M
(both OS and GPU driver are up to date)
Visual Studio 2017, Version 15.8 (also up to date) _MS_VER=1915
On this webpage, I found out that my GPU is CUDA enabled (good news) with "Compute capability" 3.0. What does it mean?
I know that CUDA versions are sensitive to the version of Visual Studio used, so
my question is simple:
what version of CUDA should I download and install? and can I build and run programs with my version of Visual Studio?
As far as I know, no version of the CUDA Toolkit currently supports Visual Studio 15.8. The latest CUDA 9.2 supposedly supports up to Visual Studio 15.6. Note that the issue of Visual Studio support really only concerns the NVCC compiler and Visual Studio Integration. There's nothing preventing you from, e.g., using the CUDA Driver API with whatever compiler you wish (including the latest version of VS).
One way around these issues used to be to put your CUDA code into a separate static library, build that with the VS 2015 compilers, and link it to the main project which could be built using VS 2017.
Make sure you have selected the VC++ 2015.3 v14.00 (v140) toolset for desktop package in Visual Studio Installer:
You can then switch the toolset to use for each project in Project Properties > General:
Unfortunately, I've recently encountered some issues with linking binaries built with VS 2015 to binaries built with the VS 2017 15.8 compilers, so that path might no longer work (seemed to be related to the new "Just My Code Debugging" feature). But then, binary compatibility across compiler versions was never really something to rely on in the first placeā€¦
Another solution would be to downgrade your Visual Studio to 15.6.
The compute capability of a device basically tells you what generation of GPU architecture you're dealing with and which features you can rely on. Or in the words of the CUDA Programming Guide:
The compute capability of a device is represented by a version number, also sometimes called its "SM version". This version number identifies the features supported by the GPU hardware and is used by applications at runtime to determine which hardware features and/or instructions are available on the present GPU.
More details on individual compute capabilities/architectures can be found, e.g., here.

Build C++/C# created with Visual Studio 2012 without VS 2012 being installed?

If I have a Visual Studio Solution file of VS2012 with few C++ native projects and a few C# projects, can I build this solution without installing Visual Studio 2012 itself?
This would ease (among other things) the maintenance on our Build-Server nodes.
You will need to install VS2012 Express.
Based on Microsoft documentation:
The Windows SDK no longer ships with a complete command-line build environment. You must install a compiler and build environment separately. If you require a complete development environment that includes compilers and a build environment, you can download Visual Studio 2012 Express, which includes the appropriate components of the Windows SDK.
There's also SharpDevelop... That should be able to build whatever you need. You may need to install the SDK, too- not sure. But it's quite a bit more lightweight than VS (express or not). And there's always Mono (and MonoDevelop/Xamarin Studio) for the C# and LLVM, MinGW and LCC for the C/C++ compilation, should you feel Microsoft's compilers have cooties. LLVM just released their first version for Windows not long ago, but it seems pretty solid... MinGW has been working on Windows for ages (and cross-compiling to Windows from various POSIX OSes, to boot). LCC can be slightly flaky at times, but it's tiny. I think the licensing is a bit restrictive, too, but you'll want to check yourself if that's the route you intend to go.
Also... just found this: Walkthrough: Using MSBuild to Create a Visual C++ Project.

Are Runtime libraries included in Visual Studio 2008 Pro by default?

Can anyone tell me how to check in visual studio if it has the following libraries included?
The first question I have is are any of these included in the VS by default by installing VS 2008.
These are the libraries:
VC++ Runtime libraries
VC++ Static MT CRT libraries
VC++ Dynamic CRT libraries
ATL MFC Shared Libraries unicode
Can you please suggest me what I need to do, if they are not included in the VC++? Can you provide me with their download links please?
This doesn't look like a linker error; it looks like a compiler error. So, yes, your colleague is right: it might have something to do with #include files, in particular with an #include file that your cpp source failed to #include.
Look for and the include the file atlcom.h and see what the compiler says then.
Microsoft Visual C++ 2008 Redistributable Package (x86)
Be sure to get all updates (windows update or e.g. InstallShield update components etc).
Notably, there has been an important update to ATL Server components which I think (IIRC) is in
Microsoft Visual Studio 2008 Service Pack 1 Update (KB974479)
Update and check this one too
Visual Studio 2008 Service Pack 1 ATL Security Update

Resources