Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a "Win32 Project", "CLR Empty Project", and "Empty Project" templates in Visual Studio?

I've just recently started working with Visual Studio this summer, primarily on CUDA and OpenCV related projects. Prior to this, I had been doing my development on Linux for CUDA using Makefiles and the common.mk makefile from NVIDIA.

So my question is as follows: I've not been able to figure out for the life of me what the difference between some of the different project templates are. I know that I've had to use "Empty Project" from the general tab of the Visual C++ options, but that's more trial and error, rather than actually knowing what is going on...

like image 387
Ian Lee Avatar asked Sep 17 '10 22:09

Ian Lee


People also ask

What is a CLR project in Visual Studio?

A common language runtime (CLR) project is used to create C++/CLI project, i.e. to use C++/CLI to target the . NET platform. The main difference between projects is what Visual Studio comes up with in terms of pre-created files.

What is Visual C++ CLR?

C++/CLI is variant of the C++ programming language, modified for Common Language Infrastructure. It has been part of Visual Studio 2005 and later, and provides interoperability with other . NET languages such as C#. Microsoft created C++/CLI to supersede Managed Extensions for C++.


1 Answers

When creating a Win32 project, the linker Subsystem is set to Windows. When creating an empty C or C++ project the subsystem is set to console. Likewise the entry point in the settings for Win32 projects expects a WinMain or DllMain while a console expects an int main. A CLR allows you to mix C++ and .NET which is usually discouraged against.

A Windows subsytem can target executables, dlls, libs or driver/native(sys) files. While a console subsystem targets console binary executables. WinMain is typically used when creating an actual Window application using the CreateWindowEx API, establishing message callbacks and inserting a message handler loop.

A console subsustem with int main can also create a Windowed application only you're better off doing it with WinMain.

A Dll empty project sets the subsystem to Windows and setting to the compiled output to (.dll) as well as the entry point to DllMain/APIENTRY and a static lib will do the same as the Dll except it will set the output to (.lib).

Setting the project to Native subsystem will require the Windows Driver Development Kit to compile drivers.

like image 60
Irelia Avatar answered Oct 15 '22 14:10

Irelia