Solved

Compiling application for specific version of Windows without prerequisites?

Posted on 2009-05-06
2
236 Views
Last Modified: 2013-11-25
I need to create an application to run in a Windows environment without any runtimes being installed first. I'm developing in Visual Studio 2005/2008. Is there a way to use C++ or C# in such an environment?
0
Comment
Question by:InterWorks
2 Comments
 
LVL 22

Assisted Solution

by:cookre
cookre earned 150 total points
ID: 24321111
c# will require some version of the .net framework - which comes with only a few versions of Windows.

c++ presumes only the standard win32 apis.
0
 
LVL 9

Accepted Solution

by:
tculler earned 350 total points
ID: 24321303
There is no way to do this with C#; however, as previously stated, C++ presumes only the standard Windows API's, and thus operates only on those present in -all- Windows machines (by all, I mean it should be all, though results always vary in this field...).

C# relies solely on the .NET Framework, and MUST run within the context of the CLR (Common Language Runtime). All of your Managed code (for example, all of your C# code) gets compiled to what we call MSIL (Microsoft Intermediate Language), or IL, for short. A computer without the CLR cannot decipher this MSIL because that is the job of the CLR--it JIT (Just-In-Time) "compiles" this IL down to native code at run-time. However, native C++ does not have this problem. Its code is directly compiled to native, and is run accordingly.

However, if you do use C++ and you plan on running the app in an environment which won't have access to the CLR, you MUST use Unmanaged C++, NOT Managed. Managed C++ is basically just C#, but with C++ syntax and capabilities (in other words, it requires the .NET Framework and the CLR to run in).

Just because IL must be JIT compiled doesn't necessarily mean it runs any slower than Native code, though. Native code loads everything into memory immediately, while the CLR compiles and runs things only as they are needed, many times saving memory.

I believe there is an alternative, here, however, where you can create a native "image" of the IL code with a program called "Ngen.exe". I don't know much about it, so I'll just post a link like a lame-ass. <a href="http://msdn.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx">Here's the link</a>
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn how to implement Singleton Design Pattern in Java.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now