Re: name decoration issue in DLL
"George" <George@discussions.microsoft.com> wrote in message
news:34A5288E-A619-4132-9A1E-8EF7B08B5BE4@microsoft.com
I think extern C is enough to prevent name from decorated, but when we
export function names from a DLL using dllexport, even if we declare
at the same time with extern C, but without a DEF file to define
un-decorated exported function names, the name is still decorated.
There are two mechanisms in play here: C++ name mangling, and C name
decoration. Name mangling encodes function signature (parameter and
return types) into exported name, which allows overloaded functions to
have distinct names for linkage purposes. Name decoration depends only
on the function's calling convention; e.g. __stdcall functions normally
get exported as _FunctionName@XX (where XX is the total size of
parameters).
extern "C" suppresses name mangling, but not name decoration. To
suppress the latter, one must use DEF file.
I do not know why DEF file is needed? extern C is not enough to
control name decoration for both DLL exported names and current DLL
model linking?
Obviously not, or you wouldn't be here asking this question.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925