How to force cdecl calling convention for functions declared in specific header file
Hi My VC2008 project uses the stdcall calling conventions. I have an external library that I am using which has been built with cdecl naming convention, however they didn't mention the calling convention in the function declaration of the functions.
I would like to know if VC has some kind of #pragma or other keyword that would force specific calling convention for the entire header file
kinda like开发者_StackOverflow中文版 the extern "C" trick but for calling conventions:
extern "C"
{
#include <file1.h>
#include <file2.h>
}
Anyone knows of such?
You can specify calling convention by:
- Do nothing and you get the default of cdecl.
- Specify
__cdecl
explicitly (or perhaps through a macro). - Elect to use cdecl throughout a translation unit by compiling with /Gd.
There's no pragma or anything similiar to control calling convention.
精彩评论