Skip to content

API Reference / @gtkx/runtime / callVfunc

Function: callVfunc()

callVfunc(owner, key, instance, inputs): unknown

Defined in: packages/runtime/dist/vfunc-call.d.ts:35

Calls the implementation of a virtual function a wrapper class or interface declares, backing the vfunc-prefixed members the generated bindings emit. The slot is read from the nearest generated wrapper class in the instance's class chain rather than from the instance's own type, so an override reaching it through super runs the implementation it replaced instead of re-entering itself. When that wrapper class does not carry the interface the slot belongs to, because a class registered below it adopted the interface, the slot comes from the interface's own default vtable instead, which holds exactly what the adopting class replaced. Arguments and the return value follow the same convention an override uses: pure out parameters are left out and returned instead, and a slot with several outputs returns them as a tuple. Throws if the owner declares no such slot, the instance descends from no wrapper class, or the resolved vtable leaves the slot empty.

Parameters

owner

AnyClass

The wrapper class or interface declaring the slot.

key

string

Name of the generated member, such as vfuncMeasure.

instance

object

The instance to invoke the slot on.

inputs

unknown[]

The arguments the slot receives.

Returns

unknown

Released under the MPL-2.0 License.