Miscellaneous Concepts of .NET – Part 1
page 4 of 9
by Uday Denduluri
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 42690/ 49

Unmanaged Portion of CLR Hosts

Let us discuss more about the unmanaged code portion of the hosts before we go into the managed portion of code. All hosts must start with an unmanaged stub. The .NET Framework provides a set of unmanaged API's the host can use to get the CLR running.

As discussed above, the unmanaged portion of CLR hosts is responsible for loading the CLR into the process. Hosts use the CorBingToRunTimeEx API to load the CLR into the process. The CorBingToRunTimeEx API takes four parameters for loading the CLR. Let us discuss each parameter in detail. The code shown below is the unmanaged API CorBindToRuntimeHost.

Listing 1

HRESULT CorBindToRuntimeHost (
    [in] LPCWSTR pwszVersion, 
    [in] LPCWSTR pwszBuildFlavor, 
    [in] LPCWSTR pwszHostConfigFile, 
    [in] VOID* pReserved, 
    [in] DWORD startupFlags, 
    [in] REFCLSID rclsid, 
    [in] REFIID riid, 
    [out] LPVOID FAR *ppv
);

·         Version - As shown in Listing 1, the pwszVersion is the parameter that determines which version of Common Language Runtime is to be loaded.

·         Server versus workstation - As shown in Listing 1, pwszBuildFlavor specifies whether to load the server or the workstation build of the Common Language Runtime.

·         Concurrent GC - StartupFlags specifies a set a predifined flags that control garbage collection.

1.    STARTUP_CONCURRENT_GC - Specifies that concurrent garbage collection should be used.

·         Loader optimization - Controls whether assemblies are loaded domain-neutrally. A domain neutral assembly is an assembly that can be shared by different application domains.

1.    STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN - No assemblies are loaded as domain-neutral. [Except mscorlib] This setting is called single domain because it is commonly used when the host is running only a single application in the process.

2.    STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN - All assemblies are loaded as domain-neutral.

3.    STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST All strong-named assemblies are loaded as domain-neutral.


View Entire Article

User Comments

Title: Good One   
Name: Shilpa Ginode
Date: 2008-05-06 2:52:19 AM
Comment:
Good article on Application Domain.
i learned this concept from this article.
Title: Good   
Name: pankaj
Date: 2007-07-18 8:00:21 AM
Comment:
good
Title: Thanks   
Name: Leonzhu
Date: 2007-05-07 10:31:56 AM
Comment:
Thanks for your excellant article
Title: Good Article on Application Doamin   
Name: Bhavannarayana.aluri
Date: 2007-04-30 1:11:05 AM
Comment:
Nice article on Application domain
Title: Excellant   
Name: Joydip
Date: 2007-04-26 3:17:22 AM
Comment:
This is an outstanding article Uday. Keep it up. I would like to see more articles of this kind from you.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 6:38:13 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search