0120: Expected calling convention type

Compiler expected a valid name of a foreign function'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.

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 <:

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

Refer to foreign function documentation to find list of available conventions and difference between them

Last updated