ICLRMetaHost::RequestRuntimeLoadedNotification Method

.NET Framework (current version)
 

Provides a callback function that is guaranteed to be called when a common language runtime (CLR) version is first loaded, but not yet started. This method supersedes the LockClrVersion function.

HRESULT RequestRuntimeLoadedNotification (  
    [in] RuntimeLoadedCallbackFnPtr pCallbackFunction);  

Parameters

pCallbackFunction
[in] The callback function that is invoked when a new runtime has been loaded.

This method returns the following specific HRESULTs as well as HRESULT errors that indicate method failure.

HRESULTDescription
S_OKThe method completed successfully.
E_POINTERpCallbackFunction is null.

The callback works in the following way:

  • The callback is invoked only when a runtime is loaded for the first time.

  • The callback is not invoked for reentrant loads of the same runtime.

  • For non-reentrant runtime loads, calls to the callback function are serialized.

The callback function has the following prototype:

typedef void (__stdcall *RuntimeLoadedCallbackFnPtr)(  
                     ICLRRuntimeInfo *pRuntimeInfo,  
                     CallbackThreadSetFnPtr pfnCallbackThreadSet,  
                     CallbackThreadUnsetFnPtr pfnCallbackThreadUnset);  

The callback function prototypes are as follows:

  • pfnCallbackThreadSet:

    typedef HRESULT (__stdcall *CallbackThreadSetFnPtr)();  
    
    
  • pfnCallbackThreadUnset:

    typedef HRESULT (__stdcall *CallbackThreadUnsetFnPtr)();  
    
    

If the host intends to load or cause another runtime to be loaded in a reentrant manner, the pfnCallbackThreadSet and pfnCallbackThreadUnset parameters that are provided in the callback function must be used in the following way:

  • pfnCallbackThreadSet must be called by the thread that might cause a runtime load before such a load is attempted.

  • pfnCallbackThreadUnset must be called when the thread will no longer cause such a runtime load (and before returning from the initial callback).

  • pfnCallbackThreadSet and pfnCallbackThreadUnset are both non-reentrant.

System_CAPS_ICON_note.jpg Note

Host applications must not call pfnCallbackThreadSet and pfnCallbackThreadUnset outside the scope of the pCallbackFunction parameter.

Platforms: See System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 4

ICLRMetaHost Interface
Hosting

Show: