The information in this article applies to:
SYMPTOMSUnexpected behavior can occur when you use extern "C" in a namespace. CAUSE
Among other things, extern "C" directs the compiler not to decorate the
names of symbols. But a symbol name is not recognized as part of a
namespace outside of a translation unit unless the namespace name is part
of the decorated name for the symbol.
RESOLUTIONDon't use extern "C" linkage in a namespace. If you have to use extern "C" linkage, use it outside of a namespace. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATIONThe following sample programs (Test1.cpp and Test2.cpp) demonstrate two cases of this. Sample Code to Reproduce Problem
The compiler names both the functions as just "_function" resulting in
the following link errors:
-or-
Additional query words: 10.00 10.10 LNK2005 LNK1169
Keywords : kbprg kbCompiler kbCPPonly kbVC kbVC400bug kbVC410bug kbVC500bug kbVC600bug |
Last Reviewed: May 18, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |