Skip to content
Dynamic 64bit __fastcall function caller
C++ Assembly Lua Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This is a class I developed to allow for calling any __fastcall function on a X64 environment. The idea is to have the call arguments built in memory prior to making the call, this way the called function prototype doesn't need to be statically compiled.

Use case: This class was used on (yet to be released) GTALua3, to call in-game functions wihout having to predefine their prototypes, and therefore allow to call different functions from Lua while researching them on IDA or any other decompiler, without having to leave the game and recompile the GTALua3 code.

This can be used also to make calls to functions from Assembly, for example, or from any other language than Lua.

The usage is very simple:

  • First create a calling context by doing:
    DynCallContext ctx;
  • Then initialize the calling context with the address of the function to call:
  • At this point, add all the arguments in order:
  • Then make the call:
    int result = ctx.Call<int>();

If enough care is taken to pass the correct argument order, types and number, the function will be called as if it was done like:
int result = SomeFunction(arg1, arg2, arg3);

The DynCall.cpp file contains a few usage examples.

You can’t perform that action at this time.