How to thunk a function in x86 and x64? (Like std::bind in C++, but dynamic)
How do I thunk an arbitrary function with an arbitrary (fixed) number of arguments, on x86 and x64? (I don't need floating-point, SSE, or the like. The arguments are all integers or pointers.) Here's my generic implementation. I initially made it with AsmJit , then modified it by hand to remove the dependency. It works for both x86 and x64! It works for both cdecl and stdcall! It should also work for "thiscall", both on VC++ and GCC, but I haven't tested it. (VC++ would probably not touch the 'this' pointer, whereas GCC would treat it as the first argument.) It can bind an arbitrary number of