Question
A lot o functions in OpenNI return like this:
XN_C_API XnInt32 XN_C_DECL xnVersionCompare (const XnVersion *pVersion1, const XnVersion *pVersion2)
I'd like to now what is XN_C_API and XN_C_DECL. Just curiosity!
Solution
It's not anything to do with the return value. Without looking at the source, I suspect that when compiling for Windows:
XN_C_API
gets defined to either__declspec(dllexport)
or__declspec(dllimport)
depending on whether you're compiling the DLL or importing functions from it.XN_C_DECL
gets defined to the desired calling convention for the function (probably__stdcall
or__cdecl
)
OTHER TIPS
Without having looked at the definitions, I'd guess:
XN_C_API
is effectivelyextern "C"
for a C++ compiler so that a C function can be called from C++.XN_C_DECL
deals with the calling conventions and export/import issues imposed by Windows. That might be__declspec(ddlexport)
or__declspec(dllimport)
, and it might include__stdcall
etc, and might also worry aboutFAR
etc (but probably doesn't need to any more).