ICLRMetaHost::RequestRuntimeLoadedNotification Method

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);


[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.




The method completed successfully.


pCallbackFunction 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.


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

Platforms: See .NET Framework System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: 4.5, 4

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft