"Jeff Kish" wrote:
ah, so the __cdecl and the extern "C" work in concert then?
Apparently, yes.
that somewhat explains why I could not combine extern "C" and WINAPI.
`WINAPI' is a simple #define for `__stdcall'. Nothing more.
I was hoping the WINAPI would standardize things, as whether or not
__cdecl
put a leading underscore in front of a name depends on compiler
version/brand.
Name decoration is vendor specific, so each compiler has its own. That's
why there is .DEF files: in order to provide a developer with an
opportunity to specify exported names exactly as he/she wants.
Contrary to popular belief, `extern "C"' linkage specifier doesn't
suppress names decoration. It just instructs the linker to generate names,
which are compatible with another language (C, in this case). It happens
that C language doesn't use name mangling, so combined with `__cdecl'
calling convention function name stays as it is. If you want to export
undecorated name of a function declared with `__stdcall' calling
convention, then .DEF file is the only option.