I’m writing a C program where I intercept the arguments to a function called by pointer before changing them and forwarding the call to the actual function, and this forwarding is done in assembly. I know that when compiling to x86 it’s possible to mark the calling convention on a per-function basis using attribute((stdcall)) so I need to know two things:
- Is it possible to change the calling convention gcc uses in x64 mode, or is that only available in 32 bit programs?
- If it is possible, can those, or similar annotations be applied to function pointers so I can ensure the functions are called properly?
I am open to using other compilers if they support this and gcc does not.