Operating System Independent Code

  • Thread starter Thread starter Rajiv Thakur
  • Start date Start date
R

Rajiv Thakur

Hi

Can i write programs in .net - vb.net/c sharp which are
operating system independent.
I can run the same code in any OS i want just as we can do
it in Java.
That is what MSIL is all about if i m not wrong.

regards
R.
 
Can i write programs in .net - vb.net/c sharp which are
operating system independent.
I can run the same code in any OS i want just as we can do
it in Java.
That is what MSIL is all about if i m not wrong.

Short answer: Yes.

Long answer: Yes, provided that there is a compiler in that OS. Mono works
in Linux. I don't know if OS X has one, but in theory Mono should work there
as well. I do know that the WinForms components of Mono is still in the
works, and that it uses wine to emulate windows looking forms (I don't know
the reason behind that).

MS does not provide compilers for anything except Windows (surprize?) but
there are teams out there that are developing for other platforms. There are
vairous other organizations that have other things available for .Net
(ActiveState).

-Akshay
 
A said:
Short answer: Yes.

Long answer: Yes, provided that there is a compiler in that OS. Mono works
in Linux. I don't know if OS X has one, but in theory Mono should work there
as well. I do know that the WinForms components of Mono is still in the
works, and that it uses wine to emulate windows looking forms (I don't know
the reason behind that).

MS does not provide compilers for anything except Windows (surprize?) but
there are teams out there that are developing for other platforms. There are
vairous other organizations that have other things available for .Net
(ActiveState).

Slight clarification here: it's not the C#->IL compiler which is needed
for that OS - the code can be compiled to an assembly in Windows and
then run on Mono in Linux. It's the CLR (usually including a JIT
compiler) which needs to be present on the target machine - the
equivalent of a JRE in the Java world.
 
A few other clarifications:

There is not presently any "official" way to run .Net applications on
non-Windows operating systems. The open-source Mono project (to run apps on
Linux/Unix/Mac systems) is still in development. If and when it works,
however, it should be very cool. It seems to have Microsoft's tacit
blessing. (Microsoft probably wants Mono to succeed, to give additional
legitimacy to the .Net platform and wean the world away from Java.) Check
out:

http://www.go-mono.com/

Also, Microsoft has released a code library called Rotor under its "shared
source" license. (I.e., noncommercial use.) This ports the CLR to
Unix-based machines (including Macs and Linux, I think), so it will
theoretically allow .Net applications to be run on these other OSes.
However, the documentation for Rotor emphasizes that it's for demonstration
purposes only, and has a "beta" quality to it. It shows that Microsoft
_could_ release the CLR to run on other platforms rather easily, if it
wanted to. (Crossing fingers.)

Hope this helps,

Robert Jacobson
 
Back
Top