I have a library in dll and its header file, I don't have source for it. I need to use pinvoke to call this unmanaged code from C#, but have problem in setting calling convention. The header file look like:
#ifdef EVOLIB_EXPORTS
#define EVOLIB_API __declspec(dllexport)
#else
#define EVOLIB_API __declspec(dllimport)
#endif
extern EVOLIB_API int ConvertRVBtoK(char *FileNameIn, char *FileNameOut,int ColorSmooth,int BlackMode);
I think ConvertRVBtoK calling convention must be __cdecl
because that is the default c/c++ calling convention. But when I check the decorated name ("?ConvertRVBtoK@@YGHPAEJJJ0E@Z") with the undname.exe utility, the result shows __stdcall
as the calling convention. Why? Is there a conflict between the dll file and header file?