Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile .NET assembly into x86 machine code

Is there any way to compile a .NET assembly into native code (i.e for x86) output, that is, without MSIL.

For what I understand if you just specify x86 as architecture this would only change the PE Header to point that out to the JIT, but still the assembly will contain MSIL and will be JITTed as needed.

NGen does produce assembly files for the specified architecture but it's not a compiler, it's designed to improve performance but you do still need the original DLL, the presence of the native image only serves to avoid JIT compiling the assembly but you just can't get that native image and use it, can you?

So, is there any way to actually compile from .NET to native machine code?

like image 759
Jorge Córdoba Avatar asked Jun 01 '11 08:06

Jorge Córdoba


People also ask

Does .NET compile to machine code?

NET, programs are not compiled into executable files; they are compiled into Microsoft Intermediate Language (MSIL) files, which the CLR then executes.

Can I code assembly in Visual Studio?

Since Visual Studio does not recognize assembly code, Visual Studio will have to be told what program to call to compile the assembly code. In this section, we'll cover the basic steps of creating a project, adding assembly code to it, specifying the Custom Build instructions, and building the project.

Does C# compile to assembly?

C# code compiles into MSIL (MS Intermediate Language) which is actually not really asm-code you get from C compiler.


1 Answers

Spoon Studio (was named Xenocode before) seems to be able to do that: http://spoon.net/Studio/Features.aspx

RemoteSoft also have a product but the website looks quite old: http://www.remotesoft.com/linker/

like image 105
Johann Blais Avatar answered Oct 14 '22 08:10

Johann Blais