Features

What the DynCall plugin does and when to use it in your own plugin.

The DynCall plugin (dyncall) calls native functions by their address at runtime. A plugin in any language pushes the arguments one by one and calls the function with the return type it expects, so no binding has to be compiled for the function. The plugin is built on the dyncall library and works on x86-64 Windows and Linux.

What it does

  • Calls by address. NewVM creates a call VM, Arg* functions push the arguments and Call* functions call the function and return its result.
  • All basic types. Booleans, 8 to 64-bit integers, float, double, pointers and C strings, for arguments and return values.
  • Calling conventions. Mode selects the convention, for example for C++ methods or variadic functions.
  • Structures by value. NewAggr and AggrField describe a structure, ArgAggr and CallAggr pass and return it.
  • One API for every language. The functions are exported through the plugin manifest, and a DCCallVM class wraps the VM in languages that support classes.

When to use it

  • You need to call a game function that the Source 2 SDK does not export, and you have its address, for example from a signature in gamedata.
  • Your language cannot call a native function pointer by itself.