import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

The **GW2RunSession** function runs the **session**, using all the previously registered artifacts.

<Tabs>

<TabItem value="C++" label="C++" default>

**Synopsis**
The **GW2RunSession** function runs session **session**, using all the previously registered artifacts.

```cpp
#include "glasswall.core2.api.h"
int GW2RunSession(Session session);
```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

**Example**

```cpp

    #include "glasswall.core2.api.h"

    HANDLE session = GW2OpenSession();
    if (!session)
        /* deal with error */
    else
    {
        /* ... register other artifacts ... */
        if (GW2RunSession(session) < 0)
            /* error running the session */
    }

    /* later */
    if (GW2CloseSession(session) < 0)
        /* error closing session */

```

</TabItem>

<TabItem value="C#" label="C#">

**Synopsis**

```csharp
public int RunSession(int session)
```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

<TabItem value="Java" label="Java">

**Synopsis**

```java
import com.glasswall.core2javabridge.*;

public int GW2RunSession(int session) throws GlasswallException
```

**Returns**

The ```GW2RunSession``` function returns a **GW2_RetStatus** enumeration converted to `int`. The value will be negative if an error occurred. `0` or `1` indicates success. Refer to the API Overview/Return types for details. 

A **GlasswallException** exception will be thrown if `session` is invalid.

</TabItem>

<TabItem value="Python" label="Python">

**Synopsis**

Runs the Glasswall session and begins processing of a file.

```py
def run_session(self, session):
    """ Runs the Glasswall session and begins processing of a file.

    Args:
        session (int): The session to run.

    Returns:
        status (int): The status code of the function call.
    """
```

**Returns**

status (int): The status code of the function call.

</TabItem>

<TabItem value="JavaScript" label="JavaScript">

**Synopsis**

This function runs the specified session.

```jsx

/**
* @param {number} session The ID of the session to be run.
*/

GW2RunSession(session)

```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

</Tabs>