Reputation:
Just a curiosity question! This seems to suggest that member function pointers are in fact different sizes pending compiler and compile options used, and this seems to suggest that function pointers are passed just fine between modules, so what about member function pointers? I mean with all the hassles that are already presented in passing data between modules it would seem rather silly to even attempt this? Or what about scenarios involving static libraries? If two different compilers are used am I wrong to assume that any scenario involving the passing of a member function pointer would be fruitless?
Upvotes: 4
Views: 576
Reputation: 222983
If you use two different compilers, then unless they have compatible ABI (application binary interface), you cannot sensibly mix-and-match any object code created by them, whether or not member function pointers are involved.
Upvotes: 5
Reputation: 156138
Member function pointers are quite different beasts from function pointers. They must encode not only the function pointer to the member function, but must also encode the the correct type for the member function, so that the run-time knows how to call the member-function. This is very dependent on how the compiler implements classes, and that implementation certainly changes between compiler vendors, and often changes within compilers based on how the compiler is invoked.
Upvotes: 1