# 0120: Expected calling convention type

Compiler expected a valid name of a [foreign function](/language/functions.md#foreign-functions)'s calling convention but found something else.

A foreign function (a declaration-only function pointing to a memory address in the game) must define the calling convention (can be either `cdecl`, `stdcall`, or `thiscall`) for the compiler to correctly pick the opcode when this function is called.

```pascal
function CStats__GetStatType<0x558E30>(statId: int): int // error: expected calling convention type (cdecl, stdcall, or thiscall), found 0x558E30.
```

#### Possible solutions:

* check your function definition and provide a correct name of the calling convention after `<:`

```pascal
function CStats__GetStatType<cdecl, 0x558E30>(statId: int): int // OK
```

Refer to [foreign function](/language/functions.md#foreign-functions) documentation to find list of available conventions and difference between them


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sannybuilder.com/troubleshooting/errors/0120.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
