# 0122: A non-static function can't be called by name

Compiler found a [foreign function](https://docs.sannybuilder.com/language/functions#foreign-functions) call, but this function is non-static, i.e. it does not have an address as part of its declaration. It is an error to call such function using the name:

```swift
function CStats__GetStatType<cdecl>(statId: int): int
int value = CStats__GetStatType(0xDEADD0D0) // error: A non-static function CStats__GetStatType can not
```

#### Possible solutions:

* Call the non-static foreign function using a function pointer variable:

```swift
function CStats__GetStatType<cdecl>(statId: int): int
CStats__GetStatType method // define a pointer to function Destroy
...
method = 0x400000 // function is located at 0x400000
int value = method(0xDEADD0D0) // call function using the pointer
```

* if the function address is known ahead of time, provide the address inside angle brackets:

```swift
function CStats__GetStatType<cdecl,0x558E30>(statId: int): int // static foreign function
int value = CStats__GetStatType(0xDEADD0D0) // OK
```
