Skip to content

Function Pointer Type

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Function Pointer Type

Function pointer types are prefixed with func, followed by a list of argument types and a return type.

func(ArgType1, ArgType2, ArgTypeN) ReturnType

Variadic Argument Support

Function pointer types only support C-style variadic arguments:

printf_pointer func(*ubyte, ...) int = func &printf

Adept-style variadic arguments are not supported in function pointers yet. If you need support for it, please create an issue on github at AdeptLanguage/Adept so adding support will come sooner rather than later.

Supported Prefix Modifiers

Supported prefix modifiers include:

  • stdcall - stdcall func() void

Usage

Functions pointer values can be called like normal functions:

my_function_pointer func() void = func &sayHelloWorld
my_function_pointer()

See Function Pointer Calls for more information

Clone this wiki locally