The difference between native and managed code?

For example, when viewing a GlowCode profiler website, it says:

"GlowCode 6.2 and x64 - native, managed and mixed C ++, C #, .NET code"

What do they mean?

+43
native managed
May 13 '09 at 2:14 a.m.
source share
4 answers

Machine code is code whose memory is not "managed", like, memory is not freed for you (C ++ and C remove free, for example), no reference counting, no garbage. Guided code, you guessed it, is code whose memory is free and allocated for you, garbage collection, and other useful properties.

Mixed code is when you control code that invokes an unmanaged level. Usually, when you have pure unmanaged C ++ DLL and you call it from .NET using P / invoke.

+63
May 13 '09 at 2:23
source share

Native code compiled to work directly with the OS. Managed code, however, is precompiled (bytecode in Java-speak), but then processed by the Just In Time compiler into native code at runtime. Managed code has an interesting side effect of being able to work across different operating systems, because machine code is not generated until the virtual virtual machine actually uses it. Thus, you can run .NET applications on Windows, as well as run them on Linux or Mac, on which the Mono runtime is installed. Portability is currently not as clean as Java (due to Microsoft's natural closed architecture), but the concept remains.

If you are using an unmanaged application, the code has been compiled to run for the specified OS / hardware. Any portability of another set of OS / commands is lost and must be recompiled for execution.

+39
May 13 '09 at 2:33 a.m.
source share

The internal code is written in the "native" language of the machine on the computer on which it is running, and is executed directly by the processor.

Managed code is written in a special language that requires the execution of another program (i.e., control). This other program is often called an interpreter because it interprets a special language.

C and C ++ programs are native.

Managed by Java and C # (and all .NET languages).

Managed C ++ is a special form of C ++ that works in the .NET interpreter.

A mixed program is a program that uses code that is both native and managed.

+24
May 13 '09 at
source share

Code that runs under the control of a common language environment (CLR) is called managed code. Code that does not run in the common language runtime is known as native code.

+5
Jun 10 '13 at 13:03
source share



All Articles