I have an existing macro, which I can't modify, used to define member functions from their addresses (reverse engineering):
#define DEFINE_FUNCTION(className, fnName, retnType, addr, ...) \
template <class... Params> \
__forceinline retnType fnName(Params&&... params) { \
typedef retnType(className::*Fn)(__VA_ARGS__); \
const static uintptr_t address = addr + g_baseAddr; \
Fn fn = *(Fn*)&address; \
return (this->*fn)(params...); \
}
How to call functions defined by this macro using another macro? It would be awesome if the new macro used this "signature" for backwards compatibility with old macro:
#define CALL_FUNCTION(obj, fn) /* stuff */
and could be used like that:
CALL_FUNCTION(this, Fn)( /* varargs /* );
I made this one and it works for normal members but it doesn't for the ones defined with variadic template macro:
#define CALL_FUNCTION(obj, fn) (obj->*(obj->fn))()
Aucun commentaire:
Enregistrer un commentaire