This is a pointless question, because if the user (who calls from c-code) does not know the types of arguments at compile time, he will not be able to provide arguments of the correct type, even if it were possible to construct a dynamically typed function pointer.
Even the gdb example, expressed in another answer, makes the assumption that the user has variables of a corresponding and known type at the dial peer.
Since this is true, I conclude that the user knows the correct types of the argument, and then the question arises of how to create a function at compile time that takes a set of arguments of a known type.
This is simply achieved: if the user has an int and two float and hopes to get an int in return and wants to call the proposed swizzle function, the type of which should be int (IIIF*)(int, int, float) , then just declare a pointer of this type, use ldload . to get the swizzle function and call it.
However, there are some special cases that can be achieved, for example, if all arguments are pointers.
Note. Known at compile time includes such cases as patterns, the values ββof which are derived at compile time from explicit or implicit type information at the time the instance and template were created.
Alex brown
source share