> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameRuntimeUninitialize

> XGameRuntimeUninitialize

# XGameRuntimeUninitialize

Uninitializes the Gaming Runtime.

## Syntax

```cpp theme={null}
void XGameRuntimeUninitialize(  
)  
```

### Parameters

None.

### Return value

Type: void

## Remarks

To use the Gaming Runtime features in your game, first initialize the Gaming Runtime by invoking the [XGameRuntimeInitialize](/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize) function. When your game is done using the Gaming Runtime and is ready to exit, uninitialize the Gaming Runtime by invoking the **XGameRuntimeUninitialize** function. Invoke the **XGameRuntimeUninitialize** function as late as possible but before your game exits, typically within the entry-point function for your game.

The following example demonstrates how to use the [XGameRuntimeInitialize](/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize) and **XGameRuntimeUninitialize** functions within the entry-point function of a game that is based on the **Direct3D 12 Desktop Game** template in Visual Studio. The **XGameRuntimeInitialize** function is invoked before the **Game** object is instantiated and registered, and the **XGameRuntimeUninitialize** function is invoked after the **Game** object is  reset but before the entry-point function returns.

```cpp theme={null}
// Entry point
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // Initialize the Gaming Runtime before
    // performing any other activity.
    if (FAILED(XGameRuntimeInitialize()))
        return 1;

    if (!XMVerifyCPUSupport())
        return 1;

    g_game = std::make_unique<Game>();

    // Register class and create window
    {
        // Code omitted for brevity.
        ...
    }

    // Main message loop
    MSG msg = {};
    while (WM_QUIT != msg.message)
    {
        // Code omitted for brevity.
        ...
    }

    g_game.reset();

    // Uninitialize the Gaming Runtime after
    // all other activity has been completed.
    XGameRuntimeUninitialize();

    return (int) msg.wParam;
}
```

## Requirements

**Header:** XGameRuntimeInit.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [What is the Microsoft Game Development Kit?](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/intro/introduction)

## See also

[XGameRuntimeInitialize](/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize)
[XGameRuntimeInit](/reference/system/xgameruntimeinit/xgameruntimeinit_members)
[Developing new titles using Gaming Runtime](/build/gdk-and-engines/guides/gdk-project-templates)


## Related topics

- [XGameRuntimeInitialize](/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize.md)
- [XGameRuntimeInit](/reference/system/xgameruntimeinit/xgameruntimeinit_members.md)
- [XGameRuntimeInitializeWithOptions](/reference/system/xgameruntimeinit/functions/xgameruntimeinitializewithoptions.md)
- [Integrate the GDK with a custom C/C++ engine](/build/gdk-and-engines/custom-engine.md)
- [Error codes](/reference/errorcodes.md)
