Refer to link https://cplusplus.com/forum/windows/56102/
The poster of the question has declared function pointers in this way:
typedef void (__cdecl* ptr)(void);
typedef double (__cdecl* ptr2)(double, double);
What is the need to put __cdecl
above? I mean even without that the code should be fine.
Also, someone responded as below:
PS I see your function pointers are declared with explicit calling convention. The functions themselves should also be delcared with (the same) explicit calling convention. This is always a good idea for DLL exports, in case the default calling convention of the DLL is different to the calling app.
I don't understand the rationale behind above suggestion. Can anyone clarify as layman OR probably with a simpler code?