Passing function pointers between modules

Just a matter of curiosity! This seems to indicate that member function pointers actually vary in size awaiting the compiler and compilation options, 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 troubles that are already presented in transferring data between modules, would it be rather stupid to even try to do this? Or about scripts related to static libraries? If two different compilers are used, am I mistaken in believing that any scenario involving passing a pointer to a member function would be fruitless?

+3
source share
2 answers

If you use two different compilers, then if they do not have a compatible ABI (binary application interface), you cannot intelligently mix and match any object code they create, regardless of whether member function pointers are involved.

+5
source

Function-function pointers are completely different animals from function pointers. They must encode not only a pointer to a member function, but must also encode the correct type for the member function, so that the runtime knows how to call the member function. This very much depends on how the compiler implements the classes, and that the implementation certainly changes between compiler providers and often changes inside compilers based on how the compiler is called.

+1

Source: https://habr.com/ru/post/1780150/


All Articles