|
Is there any third-party compiler which can convert MSIL file into the native code which can work on any windows machine without the requirement of .NET framework? It should not require the MSIL on that machine.
Here, I am not talking of ngen.exe utility, because it is a limited utility which only makes an image in native code and you still require the MSIL assembly and secondly this native image is peculier to the machine on which it was created.
Or, is it possible for any "bright" developer or group of developer to take up this assignment as an Open-source project, as this is a very challenging task.
|
|
|
|
|
any "bright" developer would know that that is just dumb..
ofcourse it would be possible to make a native c# compiler or so if you limit yourself to use primitive types and only your own classes..
but things like reflection would not work anymore.. and since reflection is used by may things in .net , all classes that depend on that would not work.
so youd end up with eg C# minus the framework classes...
and in that case... just use vb6 instead... :P
|
|
|
|
|
I don't know why this was voted 5, but this is a common misconception: .NET code is not interpreted, it's compiled. All features of .NET code runs compiled, including reflection.
It's perfectly possible to compile MSIL to native code. NGen, the JIT compiler, and RemoteSoft .NET Protector are proofs of this.
If you need more info about this topic, see this MSDN article:
Compiling MSIL to Native Code[^].
The only thing that would be lost is a bit of theoretical performance, since, by precompiling to native code, you cannot target specific processor instructions, but you'd also gain a lot of performance on application startup.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Im well aware that the code is compled to native when it runs.
however , you still need the metadata for the reflection to work.
So sure you might be able to create a compiler that compiles to native AND embeds the metadata in the compiled file..
then you need something that can actually do the reflection emulation , where would that be placed? in the compiled code ? or in a separate dll?
if in a separate dll , you are only reinventing .net
and if you want to embed all most of the .net framework functionallity in the compiled exe ... you would get a pretty huge exe
|
|
|
|
|
Roger J wrote:
if in a separate dll , you are only reinventing .net
So, why not something that could get NGEN output, statically link the needed parts of the .NET framework (which is NGENed at installation, BTW) and deploy to another machine?
Roger J wrote:
and if you want to embed all most of the .net framework functionallity in the compiled exe ... you would get a pretty huge exe
I've tested it before with ThInstall and a 2MB app became 7MB, still way smaller than the .NET 1.1 + SP1. Furthermore, the size is not always a problem: what I need is some kind of control over the environment, otherwise I'll need to test my application against every single .NET framework version. If you deployed an application to a large user base before, you probably know what I mean.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Daniel Turini wrote:
It's perfectly possible to compile MSIL to native code. NGen, the JIT compiler, and RemoteSoft .NET Protector are proofs of this.
But Anonymous' question wasn't about this.
"Is there any third-party compiler which can convert MSIL file into the native code which can work on any windows machine without the requirement of .NET framework? It should not require the MSIL on that machine."
I think that what Roger is talking about it compiler that would compile C# code into STANDALONE executable, not dependent on .NET framework. That IS dumb idea.
David
|
|
|
|
|
dnh wrote:
I think that what Roger is talking about it compiler that would compile C# code into STANDALONE executable, not dependent on .NET framework. That IS dumb idea.
And why is that idea so stupid? I don't think that it's unreasonable to think about an application that ships with static libraries (in this case, linking the .NET framework into the application). The deployment and testing is really easier and safer when you use static linking. Why? Because you don't have to test with every possible version of the .NET framework, and every different patch set to check if your application works fine. Did you ever try to deploy and support an application on 10,000 machines, in around 300 different companies? You'd give a leg for a static linker...
And the origional post mentioned that static linking and native code compilation would remove a lot of .NET features, e.g., reflection. I disagree, unless someone proves me that: when a .NET application is loaded, it's JIT compiled to native code (if it wasn't pre-compiled by NGEN), and then linked to the .NET framework, which was compiled to native code by NGEN upon installation.
So, can someone explain me why is it so dumb to do all this on the programmers machine, instead of doing this on the user's machine? The only drawback I can see is losing a few machine specific optimizations (which still could be done by generating several versions).
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
ok maybe I didn't express myself clear. How I understood Anonymous' question is, forget .NET, I want to compile C# directly to native, just like C++ does. That's different from static linking, is it not?
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
dnh wrote:
ok maybe I didn't express myself clear. How I understood Anonymous' question is, forget .NET, I want to compile C# directly to native, just like C++ does.
No, he wants to take an MSIL executable and compile to native code, and statically link the parts of the .NET framework needed.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Hi all,
I am facing a problem i am using office 2003's smartdocument feature to generate a doc and want to convert it to a pdf doc using c#.net but the problem is i also want the hyperlinks mentioned in the smartdoc to be active hyperlinks in pdf pls help me with the solution
Need ur help
|
|
|
|
|
#define hextobin(c) ((c)>='a'&&(c)<='f' ? (c)-'a'+10 : (c)>='A'&&(c)<='F' ? (c)-'A'+10 : (c)-'0')
unsigned char BinKey[16];
for(int i=0; i < KeyEdit->Text->Length; i=i+2)
{
BinKey[i>>1] = (unsigned int)(hextobin(KeyEdit->Text->get_Chars(i)) << 4) + hextobin(KeyEdit->Text->get_Chars(i+1));
}
converted c#
string hexKey = "ffffffffffffffffffffffffffffffff"; //32 f s'
int byteLength = hexKey.Length/2;
byte[] bytes = new byte[byteLength];
int j=0;
string binKey = "";
for (int i=0; i
|
|
|
|
|
|
Does anybody know how to get the size in memory of an instance of a manged object. The more I look for an answer, the stronger my suspicion gets that it's not possible.
|
|
|
|
|
Did you try System.Runtime.InteropServices.Marshal.SizeOf ?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yip, I tried it but It can only be used for unmanaged types.
|
|
|
|
|
This blog[^] seems to give answer you are looking for. But I don't know how about .NET 2.0
David
|
|
|
|
|
Hi all!
I've a slight problem bugging me for some time now and was wondering what you think to be the best solution:
In the installation package (.msi created from a setup project in VS2003) of my app I'll have to perform some custom actions after the installation has finished. For example, modifying config files to reflect user input during installation.
This is done in a custom action on install. The custom action itself is an installer class written in C#.
So far, so good. It works fine when you run the setup from a CD or a local drive, but often the application isn't installed on a single machine only, but several machines in a network.
Now when you put the .msi on a network folder and run it from there the custom action usually chokes because of security settings in .NET.
When run from a network location, the custom action assembly doesn't have the neccessary access rights for local files and the registry.
So you either have to copy the installation package to a local drive or adjust .NET security settings for your network (and, if you want to run the installation from an UNC path, even for your Internet zone!).
What's the best way to deal with this?
Re-write the custom action classes in unmanaged code?
Modify .NET security settings during installation somehow?
Any other way?
Thanks in advance for your feedback...
mav
P.S.: Another point to consider is when I want to include the installation of .NET framework in my setup, then there's no way to manually adjust security settings before the installation of my app....
|
|
|
|
|
Hi,
I am struggling in using dataset or traditional dataReader in ADO.Net.
It seems to me that if I use the dataset (direct bind it to UI), then the dataset will replace the object model layer, so it seems only good for simple application development without much object model logic.
If I insert a object layer
above the dataset, then it seems no difference from the traditional
approach by using DataReader with SQL query. Then what is the goodness
of dataset ?
And if I use dataset, the cached data by read/write in the dataset will be lost if the application hang, so the cached data by read/write should be restricted within the scope of one transaction.
Are all my perceptions on using dataset above right ? Any comments?
Thanks
|
|
|
|
|
Hi All
I am looking for a solution to a problem regarding web service. I want to call a web method of a web service, but I don’t want to use wsdl nor can I generate the proxy class. The scenario is that, in my application user can fill in the web service address and a list of methods with parameters, he wants to execute and I have to get the results.
I have some solution to this problem. Right now i am using WSE to solve this problem. My code is:
Dim env As SoapEnvelope
Dim epr As EndpointReference
Dim client As MyHttpClient
Dim rs As SoapEnvelope
Dim bodyResponse As String
env = New SoapEnvelope
env.Context.Addressing.Action = New Action("http://tempuri.com/TestWebService/MyService/HelloWorld")
env.CreateBody()
env.Body.InnerXml = String.Format("<HelloWorld xmlns=""http://tempuri.com/TestWebService/MyService/"" />")
epr = New EndpointReference(New Uri("http://localhost/TestWebService/MyService.asmx"))
client = New MyHttpClient(epr)
rs = client.Hello_World(env)
bodyResponse = rs.Body.OuterXml
TestReport.Text = bodyResponse
Imports System.Xml
Imports Microsoft.Web.Services2
Imports Microsoft.Web.Services2.Addressing
Imports Microsoft.Web.Services2.Messaging
Imports System.Web
Public Class MyHttpClient
Inherits SoapClient
Public msg As String = String.Empty
Public LoadTesterForm As LoadTesterForm = Nothing
Public Sub New(ByVal dest As EndpointReference)
MyBase.New(dest)
End Sub
<SoapMethod("http://tempuri.com/TestWebService/MyService/HelloWorld")> _
Public Function Hello_World(ByVal envelope As SoapEnvelope) As SoapEnvelope
Dim response As SoapEnvelope
response = MyBase.SendRequestResponse("HelloWorld", envelope)
msg = response.Body.OuterXml
Hello_World = response
End Function
Protected Overrides Sub FilterMessage(ByVal envelope As Microsoft.Web.Services2.SoapEnvelope)
MyBase.FilterMessage(envelope)
End Sub
End Class
I am getting the response back with this code.
Main problem is env.Body.InnerXml, Here we need to specify all the parameters & method name as XML. But i dont have parameter names.
One solution to this problem might be i can generate proxy class at runtime. Can anybody guide me to the right direction?
Thanks a lot
Sumit Domyan
|
|
|
|
|
Can someone point me in the right direction? I have an application shell with a status bar. the shell is going to download assemblies and dynamically creating menu items and toolbar buttons to call the forms from the downloaded assemblies to load up in the shell. How do the downloaded assemblies talk to the shell like write something to the status bar? How should i set the framework up?
misticat
|
|
|
|
|
I have an excel file with 3 sheets.
I want todrag 1 sheet on to my form and do some custom stuff with it.
and links on how or help?
Nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hi;
Any suggestions for a Form (not ASP .NET) tree control - I need one that can have check boxes on just some lines and the .NET one is all or nothing.
And a PropertyGrid control? The .NET one has everything I need but when called from my Word Add-In code none of the attributes work.
??? - thanks - dave
|
|
|
|
|
I would override the ownerdraw by extending the Treeview
my half a penny
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
the treeview dont support ownerdraw ... unless your into some heavy api interopping...
Its pretty much easier to create one from scratch than to do the api customdraw stuff on treeviews.
|
|
|
|
|
Igot the MFC treeview confused again.
I forgot that MS did a rush job in the TreeView which is crap anyhow.
Sry,Nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|