FIX: LNK2019 Error Message When You Port ATL DLL Project to Visual C++ .NET (319853)



The information in this article applies to:

  • Microsoft Visual C++ .NET (2002)

This article was previously published under Q319853

SYMPTOMS

When you create an Active Template Library (ATL) DLL project in Microsoft Visual C++ 6.0 with the Allow merging of proxy/stub code option selected, port the project to Visual C++ .NET, add an ATL object to the project, and then try to build this solution in Visual C++ .NET, you may receive LNK2019 error messages that are similar to the following error messages:
"Linking...
Creating library .\Debug/atl dll 602.lib and object .\Debug/atl dll 602.exp
atl dll 602.obj : error LNK2019: unresolved external symbol _PrxDllMain@12 referenced in function _DllMain@12"

CAUSE

To merge proxy/stub code successfully in Visual C++ .NET, the _MERGE_PROXYSTUB must be defined and Dlldatax.c must be included in the build. In Visual C++ .NET, the ATL Add Class wizard checks whether Dlldatax.c is added to the project. If Dlldatax.c is included, the ATL Add Class wizard will add the _MERGE_PROXYSTUB preprocessor definition automatically. This occurs when you build a new Visual C++ .NET project. However, in Visual C++ 6.0, Dlldatax.c is not included in the build by default.

RESOLUTION

To work around this behavior, follow these steps:
  1. In Solution Explorer, right-click Dlldatax.c, and then click Properties.
  2. In the Properties dialog box, in the left pane, below Configuration Properties, click General. In the right pane, set Excluded From Build to No.
  3. In the left pane, below C/C++, click to select Precompiled Headers. In the right pane, set the Create/Use Precompiled Header option to Not Using Precompiler Header.
  4. Rebuild the project.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Microsoft Visual C++ .NET (2003).

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a default ATL DLL project in Microsoft Visual Studio 6.0 with the Allow merging of proxy/stub code option selected.
  2. Open this .dsw file in VS .NET, and then build the project.
  3. From Class View for this project, add a new class of the type ATL Simple Object.
  4. Rebuild the project.

Modification Type:MinorLast Reviewed:4/30/2003
Keywords:kbfix kbbug kbpending KB319853