Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / March 2004

Tip: Looking for answers? Try searching our database.

.NET applications not portable ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 28 Mar 2004 13:41 GMT
Hi,

I've seen the following being explained about .NET applications in a C#
Microsoft Course :

"An assembly executable (exe) contains a small amount of unmanaged code,
known as the stub, which is used to load the .NET CLR and start execution of
the application. The reason this is unmanaged code is because the OS loader
in W2K and in previous Windows OS's doesn't recognize .NET applications and
because the runtime has not yet been loaded.
The stub is not present in assemblies that are not applications."

Does this mean then that my assembly executables (compiled on W2K) are not
able to run on Linux (using e.g. Mono) or on another OS that supports .NET,
since that portion of unmanaged stub (win32-code) will not be able to run ?

Thnx
Chris
Jon Skeet [C# MVP] - 28 Mar 2004 17:49 GMT
> I've seen the following being explained about .NET applications in a C#
> Microsoft Course :
[quoted text clipped - 9 lines]
> able to run on Linux (using e.g. Mono) or on another OS that supports .NET,
> since that portion of unmanaged stub (win32-code) will not be able to run ?

No, you will be able to run them, but you may need to explicitly say to
load the CLR, eg saying:

mono foo.exe

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Chris - 29 Mar 2004 10:08 GMT
Hi Jon,

executing :   mono foo.exe

does it mean then that the unmanaged stub part of file 'foo.exe'  (that
contains win32 code if compiled on Win) will not be used then ?

thnx
Chris

> > I've seen the following being explained about .NET applications in a C#
> > Microsoft Course :
[quoted text clipped - 14 lines]
>
> mono foo.exe
Matt Davey - 29 Mar 2004 10:27 GMT
I believe, but could be wrong, that the PE header just has a bit set to say
its for .NET
http://www.codeproject.com/dotnet/insidedontnet.asp gives a little detail

http://www.smidgeonsoft.com/ has an interesting PE header utility

Later
http://weblogs.asp.net/mdavey/

> Hi Jon,
>
[quoted text clipped - 30 lines]
> >
> > mono foo.exe
Jon Skeet [C# MVP] - 29 Mar 2004 13:49 GMT
> I believe, but could be wrong, that the PE header just has a bit set to say
> its for .NET
> http://www.codeproject.com/dotnet/insidedontnet.asp gives a little detail
>
> http://www.smidgeonsoft.com/ has an interesting PE header utility

It's not just a bit being set. From the link above:

<quote>
The following section to the above is also a bit interesting. There we
have said that there is link to another module mscoree.dll. That is the
core of common language runtime. It also specifies the entry point to
the mscoree.dll, which allows the module to be attached to the current
process. Here it=3Fs shown as 0 _CorExeMain.
</quote>

That's what gets .NET loaded, basically.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Matt Davey - 29 Mar 2004 10:38 GMT
The ECMA spec details the PE header:
http://www.ecma-international.org/publications/standards/Ecma-335.htm

Later

> Hi Jon,
>
[quoted text clipped - 30 lines]
> >
> > mono foo.exe
Jon Skeet [C# MVP] - 29 Mar 2004 13:47 GMT
> executing :   mono foo.exe
>
> does it mean then that the unmanaged stub part of file 'foo.exe'  (that
> contains win32 code if compiled on Win) will not be used then ?

Indeed.

Basically the stub part just tells it which CLR to load, and the
"mono" bit does that already.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.