General Development

.NET? – luke

luke

Member

Posts: 311
From: I use your computer as my second Linux box
Registered: 10-30-2005
Ok simple/stupid question about .NET:

I have VC++.NET 2005, I am wondering if I just compile a regular win32 project w/build project, will I get native code or .NET code?

How do I know if I have .NET code and how do I make my compiler do .NET
or, if it is .NET by DEFAULT: how do I force a native code compile?

------------------
I reject your reality and substitute my own!

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
Hmm I'm no expert in this but you can find the option "common language runtime support" from the project option's general options page. And I think people need to have some CRT dlls if they want to run the apps you compile with it.

------------------
2Co 7:10 For godly sorrow worketh repentance to salvation not to be repented of: but the sorrow of the world worketh death.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
I'm not sure what you mean by 'native code or .NET code'. I *THINK* you may be referring to the executable and not actually the written/typed code, but I am not sure.

You will get a regular ol' Win32 EXE.

To get a .NET executable, you need to use the .NET set of classes. You will know you have .NET code by using the .NET set of classes. By creating a .NET project (app, dll, etc.) the settings for .NET are already created for you and the compiler will compile the code for .NET.

As far as I know, there is not a way to currently compile .NET code into a native EXE.

To sum it up. Use Win32 code, get a Win32 EXE. Use .NET code, get a .NET EXE.

Not to muddy the waters, but there are variations in-between where you can use .NET and create mangaged sections of code within your C++ application. I mention it merely to say there is more to it than I explained. If you are just starting out with .NET, I suggest taking the simple approach and creating a completely Win32/MFC application or creating a completely .NET application.

luke

Member

Posts: 311
From: I use your computer as my second Linux box
Registered: 10-30-2005
Thanks guys; that cleared up some issues for me =D

------------------
I reject your reality and substitute my own!

steveth45

Member

Posts: 536
From: Eugene, OR, USA
Registered: 08-10-2005
Just so you all know, .NET can be compiled to native code, but not prior to distribution. If you have a .NET app with a windows installer, the installer can compile the IL code (using ngen, which is on any computer that has .NET installed) into precompiled native code for the target system. This code gets stored into a system folder and makes that program or dll run faster since the runtime doesn't have to use JIT compilation. This is exactly what Sharpdevelop does when you install it, it compiles itself to native code for your particular machine during the install. You can see it happening during the install, that's how I knew it was available. Here is an article about the topic: http://msdn.microsoft.com/msdnmag/issues/06/05/CLRInsideOut/ .

------------------
+---------+
|steveth45|
+---------+

SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
Cool. Thanks for the info. I was not aware of it, but figured something probably existed or would exist, given enough time. I was hoping someone else would chime in about that, and actually meant to add such a note when I wrote that sentence.

[This message has been edited by SSquared (edited July 05, 2006).]