I want to call a pure C style function from a dll in my C++ program. I tried casting my function pointer using reinterpret_cast to __cdecl and still the calling convention of _stdcall seems to be preserved. I am new to Windows C++ programming.
This is my C++ call
reinterpret_cast< Error ( __cdecl*)(int,int)> (GetProcAddress(Mydll::GetInstance()->ReturnDLLInstance(), "add"))(1,10)
actual function in the dll is
Error __cdecl add(int,int);
Debugger throws me the error run time check failure #0
. I am working in Windows-C++. Also I am exporting functions from my dll and I dont have access to my C files.