HighTechTalks DotNet Forums  

Compiling .NET assembly to equivalent native code

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Compiling .NET assembly to equivalent native code in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
LOST
 
Posts: n/a

Default Compiling .NET assembly to equivalent native code - 10-21-2006 , 07:43 AM






I need to compile .NET assembly to native code. Microsoft's utility
NGEN does not produce an executable file. Instead of this, it places
the precached image to WinDir\Prefetch.This image is not a PE file.
I need the one producing PE or equivalent code in C or C++ native. Can
anybody help?


Reply With Quote
  #2  
Old   
Michael Nemtsev
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-21-2006 , 08:48 AM






Hello LOST,

L> I need to compile .NET assembly to native code.

What do u mean? Do u want to get pure unmanaged code from managed sources?
it's impossible

L> Microsoft's utility NGEN does not produce an executable file. Instead
of this, it places
L> the precached image to WinDir\Prefetch.This image is not a PE file.

Yep, NGEN gives u platform-compiled version of your app, to avoid compilation
during starting application. The reason - to improve start up time, avoid
IL compilation

L> I need the one producing PE or equivalent code in C or C++ native.

..NET apps has the PE, but it comprises shrim class that responsible for starting
app under .net framework

---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche




Reply With Quote
  #3  
Old   
LOST
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-21-2006 , 10:10 AM



Michael Nemtsev wrote:
Quote:
Hello LOST,

L> I need to compile .NET assembly to native code.

What do u mean? Do u want to get pure unmanaged code from managed sources?
it's impossible
impossible? Actually, I need almost the same code JIT compiler produce,
but stored in separate executable. Why is it impossible?



Reply With Quote
  #4  
Old   
Michael Nemtsev
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-21-2006 , 11:30 AM



Hello LOST,

Such is the .NET architecture.

Executable is only the assembly (in case of EXE file) that has a standard
PE hearder. And that uses unmanaged mscoree.dll to init all work to start
you managed code.
NGEN there helps to avoid compilation - when u call smth u redirected to
the NGEN image not to process of JIT compilation

L> Michael Nemtsev wrote:
L>
Quote:
Hello LOST,

L> I need to compile .NET assembly to native code.

What do u mean? Do u want to get pure unmanaged code from managed
sources? it's impossible

L> impossible? Actually, I need almost the same code JIT compiler
L> produce, but stored in separate executable. Why is it impossible?
L>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche




Reply With Quote
  #5  
Old   
Francois PIETTE
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-21-2006 , 11:31 AM



Quote:
L> I need to compile .NET assembly to native code.

What do u mean? Do u want to get pure unmanaged code from managed
sources?
it's impossible

impossible? Actually, I need almost the same code JIT compiler produce,
but stored in separate executable. Why is it impossible?
Because this code need the .NET runtime. Actually .NET is another operating
system than the underlaying OS (win32).

If you need native code, you should consider rewriting your application as a
win32 application.

--
Francois PIETTE
http://www.overbyte.be




Reply With Quote
  #6  
Old   
LOST
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-22-2006 , 05:49 AM



Indeed, I understand JIT-compiled code requires runtime to execute.
I found one solution. It's Salamander. But it costs about $1200.


Reply With Quote
  #7  
Old   
Michael Nemtsev
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-22-2006 , 06:46 AM



Hello LOST,

L> Indeed, I understand JIT-compiled code requires runtime to execute. I
L> found one solution. It's Salamander. But it costs about $1200.

Salamander is Decompiler - it just takes your managed binary and decomplile
it to the managed source code
There is nothig about "get unmanaged binary from managed source"

---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche



Reply With Quote
  #8  
Old   
PS
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-22-2006 , 09:40 AM




"Michael Nemtsev" <nemtsev (AT) msn (DOT) com> wrote

Quote:
Hello LOST,

L> Indeed, I understand JIT-compiled code requires runtime to execute. I
L> found one solution. It's Salamander. But it costs about $1200.

Salamander is Decompiler - it just takes your managed binary and
decomplile it to the managed source code
There is nothig about "get unmanaged binary from managed source"
<quote>
Our protector is not an obfuscator, rather it converts the decompilable
Microsoft Intermediate Language code (MSIL or CIL) of your assemblies into
native format while keeping all .NET metadata intact, and thus it provides
the same level of protection as native C/C++ code.
</quote>

It's $1899 by the way. Xenocode also have something called PostBuild
(www.xenocode.com).

PS

Quote:
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche




Reply With Quote
  #9  
Old   
John
 
Posts: n/a

Default Re: Compiling .NET assembly to equivalent native code - 10-23-2006 , 11:57 AM



LOST wrote:
Quote:
I need to compile .NET assembly to native code. Microsoft's utility
NGEN does not produce an executable file. Instead of this, it places
the precached image to WinDir\Prefetch.This image is not a PE file.
I need the one producing PE or equivalent code in C or C++ native. Can
anybody help?

I hear you; I wanted something like this too at one time. But for one
thing the jitter can change the executed binary code around while the
program is running in order to optimize it, so the whole idea of what
you want is impossible because the code the jitter generates can depend
on the context of the execution which would not be known if you wanted
something to generate code.

It might be possible for somebody to create a program that would take an
assembly and generate a native executable from that, but as far as I
know there is nothing like that on the market today.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.