ID: Q132341
1.00 1.50 1.51 1.52 WINDOWS kbprg kbprb
The information in this article applies to:
When building a DLL that uses the Microsoft Foundation Classes (MFC), the Visual C++ linker reports the following error:
error L2029: 'public: __far __pascal
AFX_EXCEPTION_LINK::AFX_EXCEPTION_LINK(void)__near' :
unresolved external
The MFC User DLL (_USRDLL) or Extension DLL (_AFXDLL) that you are building is made up of static libraries (.LIB) that also contain MFC code, and there is a TRY/CATCH/END_CATCH block in the static library code.
The problem occurs because of the compiler options used to build the static library. AFX_EXCEPTION_LINK needs to be defined as a __far struct rather than as a __near struct.
You need to make sure the static libraries are compiled with the same options you use to build the _USRDLL or _AFXDLL because that is where the code is being used. For example, you need to define the preprocessor symbol "_USRDLL" for _USRDLLs, and "_AFXDLL" for _AFXDLLs. You also need to compile for large memory model for both types of DLLs.
This behavior is by design.
For more information on building _USRDLLs, please see MFC Tech Note 11. For more information on building _AFXDLLs, please see MFC Tech Note 33.
Additional reference words: 1.00 1.50 5.5 5.6 5.50 5.60 5.60.339 KBCategory: kbprg kbprb KBSubcategory: MfcDLL
Keywords : kb16bitonly kbDLL kbMFC kbVC
Version : 1.00 1.50 1.51 1.52
Platform : WINDOWS
Last Reviewed: July 20, 1997