I wonder C# can produce native win32 code.
I have read several articles about C#,
and I found it very useful because you don't have to remember all the
"starting" syntax and you still have a decent garbage collector and you
might use pointers too as needed. However I am worrying about if it could
produce native code. I suspect I'll have to use the .NET Framework. Is that
right? Any comments are welcome!
Thanks
Jack 8 9034
Hello Jack,
See unsafe keyword in MSDN http://msdn2.microsoft.com/en-us/library/chfa2zb8.aspx
Take into account that CLR don't verify unsafe code
J> I wonder C# can produce native win32 code.
J> I have read several articles about C#,
J> and I found it very useful because you don't have to remember all the
J> "starting" syntax and you still have a decent garbage collector and
J> you
J> might use pointers too as needed. However I am worrying about if it
J> could
J> produce native code. I suspect I'll have to use the .NET Framework.
J> Is that
J> right? Any comments are welcome!
J> Thanks
J> Jack
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jack wrote: I wonder C# can produce native win32 code. I have read several articles about C#, and I found it very useful because you don't have to remember all the "starting" syntax and you still have a decent garbage collector and you might use pointers too as needed. However I am worrying about if it could produce native code. I suspect I'll have to use the .NET Framework. Is that right? Any comments are welcome! Thanks Jack
I am afraid you are stuck with the .NET framework and managed code. No
native code with c#, period.
Jack wrote: I wonder C# can produce native win32 code.
Why not ? But the C# compiler shipped with the .NET framework cannot do
that (yet). Currently you can use NGen.exe to compile a native managed
executable out of any C# assembly, but you are bound to the .NET
framework anyways. You only save delay caused by the JIT compilation on
startup.
I have read several articles about C#, and I found it very useful because you don't have to remember all the "starting" syntax and you still have a decent garbage collector and you might use pointers too as needed. However I am worrying about if it could produce native code. I suspect I'll have to use the .NET Framework. Is that right? Any comments are welcome!
Microsoft research has used a native C# compiler, called Bartok to
compile the research OS Singularity. http://research.microsoft.com/act
IIRC this compiler uses a small compact runtime, not the .NET framework
itself. Perhaps it will be available and part of VStudio, when the
compiler framework Phoenix is released which IMHO will be the basis of a
native C# compiler.
Thanks Jack
Andre
You can specify /unsafe compiler option. In this case CLR don't verify you
app, that leeds to some limitations, and allows use unmanaged constructions I am afraid you are stuck with the .NET framework and managed code. No native code with c#, period.
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Unsafe != native code, and that's what the OP is asking about.
Willy.
"Michael Nemtsev" <ne*****@msn.com> wrote in message
news:F2**********************************@microsof t.com...
| You can specify /unsafe compiler option. In this case CLR don't verify
you
| app, that leeds to some limitations, and allows use unmanaged
constructions
|
| > I am afraid you are stuck with the .NET framework and managed code. No
| > native code with c#, period.
|
| --
| WBR,
| Michael Nemtsev :: blog: http://spaces.msn.com/laflour
|
| "At times one remains faithful to a cause only because its opponents do
not
| cease to be insipid." (c) Friedrich Nietzsche
|
yep,
just missed the point of original question Unsafe != native code, and that's what the OP is asking about.
Willy.
"Michael Nemtsev" <ne*****@msn.com> wrote in message news:F2**********************************@microsof t.com... | You can specify /unsafe compiler option. In this case CLR don't verify you | app, that leeds to some limitations, and allows use unmanaged constructions | | > I am afraid you are stuck with the .NET framework and managed code. No | > native code with c#, period.
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Well, you can't get completely to native code, because C# assumes
garbage collection, so at the minimum, you would need some garbage
collecting framework (like the CLR) between the code and the Win32 API.
However, if you accept that, not only CAN it be done, it IS being done.
It's just done in two steps. At compile time, C# is translated in IL,
and then at run time, IL is translated into native code. Hence C# has
produced native code. There is a way to do both steps at compile time,
but overall, it's best to let the final step be done on a machine that
actually going to run the code. (Presently, and by necessity if you
precompile, the native code produced will be tuned so that it might run
better on a Pentium, but will nevertheless run on a 80386. However, in
the future, we should be getting JITters that will target exclusively
the chip type that it is being run on) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: David Kantowitz |
last post by:
I am trying to wrap a native-C++ DLL in managed C++, to
use in a .NET project.
The native code is compiled into a DLL, and I have created
a .def file that exports the mangled names of the...
|
by: dln |
last post by:
Hey all. I'm a bit new to the language and I'm trying to figure out how to
have my c# application interact with native code that is exported via a dll.
I've run into a problem interfacing with a...
|
by: Xavi Sam |
last post by:
Hi
When I build my asp.net application the ASP.NET generates a net.assembly by
page in the directory of my pc:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files
Theese...
|
by: Herby |
last post by:
Is possible to have a managed method within a Native(un-managed) class
within a \clr project?
E.g.
class myClass
{
public:
#pragma managed
void myMethod(void);
|
by: Lonewolf |
last post by:
Hi all,
I'm having difficulties passing data back to managed class from my
native class when the data is generated from within a native thread in
the native class itself. I will give the following...
|
by: Gary Nastrasio |
last post by:
If I compile with /clr:safe, which is exactly meant by saying I can't
use "Native Types" in my code? Is a native type something such as
float, short, or int?
Thanks,
Gary
|
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
I have a class that is writen in unmanaged pure native C++.
This class files (h and cpp) are inserted to a managed C++ (VC++ 2005,
C++/CLI) DLL compoenet.
This DLL compoenet is used in a C#...
|
by: etiainen |
last post by:
Hi everyone!
I'm in a bit of a problem here:
I have to make a maven project for native (jni & C) code.
I am using this plugin:...
|
by: Bob Altman |
last post by:
Hi all,
We have a native class modeled after the System::Exception class, and all
exceptions that we throw derive from this class. For now this class is
quite simple: just Description and...
|
by: joes.staal |
last post by:
Hi,
I know this has been asked earlier on, however, none of the other
threads where I looked solved the following problem.
1. I've got a native C++ library (lib, not a dll) with a singleton.
2....
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |