Microsoft KB Archive/166817

= FIX: Alpha MFC Regular DLL Fails After Porting from Intel =

Article ID: 166817

Article Last Modified on 11/18/2003

-

APPLIES TO

 Microsoft Visual C++ 4.0 Standard Edition, when used with:  the hardware: DEC Alpha

 the hardware: DEC Alpha 

-



This article was previously published under Q166817



SYMPTOMS
When moving a Visual C++ 4.x MFC regular DLL (_USRDLL) project from the Intel platform to the Alpha RISC platform you may run into one or more of a set of related problems. Some symptoms are:


 * CWinApp::InitInstance is not called.
 * Resources stored in the DLL fail to load because AfxGetResourceHandle or AfxFindResourceHandle returns NULL or an incorrect resource handle.
 * AfxGetInstanceHandle returns NULL.
 * Standard MFC database, sockets, or OLE resources fail to load. For example, AfxLoadString(AFX_IDP_SQL_CONNECT_FAIL) returns an empty string, even when the Regular DLL is properly using the MFC Database classes.



CAUSE
When you create the Alpha configuration from an existing Intel based configuration, the Visual C++ development environment does not copy the /D _USRDLL compiler flag. This problem does not cause compiler or linker errors.

Without this symbol defined, the default non-MFC DllMain is used and MFC is not initialized.



RESOLUTION
Make sure that /D "_USRDLL" is in the compiler options for regular MFC DLLs. If not, add _USRDLL to the list of preprocessor definitions.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 5.0.

<div class="references_section">