Microsoft KB Archive/830482

= The Run-time Type Information library for the Pocket PC 2003 SDK is available =

Article ID: 830482

Article Last Modified on 11/2/2004

-

APPLIES TO


 * Microsoft Windows Mobile 2003 software for Pocket PCs Standard Edition
 * Microsoft eMbedded Visual C++ 4.0

-



SUMMARY
To provide developers with full Microsoft eMbedded Visual C++ Exception Handling and dynamic cast support on Microsoft Windows Powered Pocket PC 2003 devices, Microsoft is distributing the Run-time Type Information (RTTI) library for the Pocket PC 2003 SDK.

The following file is available for download from the Microsoft Download Center:

Download the RITTI.exe package now.

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

The RTTI.exe download includes the library files (.lib) and program database files (.pdb) for the &quot;ArmV4&quot; and &quot;emulator&quot; builds.

To use the RTTI library in a Pocket PC 2003 project, follow these steps:  Copy the Ccrtrtti.lib and Ccrtrtti.pdb files from the ArmV4 and Emulator folders in the download to the folders that are named ArmV4 and Emulator inside the \Lib folder of the Pocket PC 2003 SDK.

Note By default, these directories are found in the C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Lib\ folder on desktop computers that have the Pocket PC 2003 SDK installed. For all project configurations that you intend to target, include Ccrtrtti.lib in Project Settings of eMbedded Visual C++ 4.0, follow these steps:  In eMbedded Visual C++ 4.0, click the Link tab in the Project Settings dialog box. Type Ccrtrtti.lib in the Object/Library modules box. Click OK.  Follow these steps:  In the Project Settings dialog box, click the C/C++ tab.</li> Add the /GX switch in the Project Options list. You need this switch to compile exception handling code in the project.

Note If the project uses dynamic cast, add the /GR switch.</li></ol> </li></ol>

<div class="moreinformation_section">

MORE INFORMATION
C++ Exception Handling code that uses &quot;throw&quot; constructs, &quot;catch&quot; constructs, or both with data types requires RTTI support to identify the type of exception. Without the RTTI library, typed C++ Exception Handling code causes a linker error message that is similar to the following error message:

error LNK2001: unresolved external symbol &quot;const type_info::`vftable'&quot; (??_7type_info@@6B@)

For example, without the RTTI library, the following code causes the previous linker error: try

{

// The code here can raise exceptions.

}

catch(int i)

{

// Optional exception handling logic goes here.

} The linker returns the error because it cannot find the RTTI library that is required for type-identification of exceptions of type int.

The same logic applies to &quot;throw&quot; constructs that involve any data. For example, the statement throw 1; requires RTTI to determine the matching &quot;catch&quot; block that would handle exceptions with int values.

Without the RTTI library, the only exception handling construct that works is the kind that involves no data types. For example, the following code links without the RTTI library without causing an error message: try

{

// The code here can raise exceptions.

}

catch(...)

{

// Generic exception handling logic goes here.

} With the RTTI library files, all the C++ Exception Handling constructs (typed and un-typed) that are in this section of this article should generate correct executables. You do not have to have extra DLLs because the RTTI logic is already in the DLLs that are on the Pocket PC 2003 device and emulator.

The following is a known problem with eMbedded Visual C++ 4.0 Service Pack 2 (SP2) when you use this RTTI library. Single-stepping through the code over the closing brace after the last logical statement in the try/catch block in an application would cause the following events:
 * A crash occurs in the executable of the application on the Pocket PC 2003 emulator.
 * The application stops responding (hang) on the Pocket PC 2003 device.

At the point of the crash or when the application stops responding (at the end of the try/catch block), the eMbedded Visual C++ IDE will report an access violation with the following error message:

First Chance exception

Microsoft is aware of this problem and is working toward fixing this problem in a future release.

The workaround to this problem is to set a breakpoint at the first statement after the end of the try/catch block and then to let the application run through the end of the try/catch block and continue debugging at the breakpoint. Do not single-step through the code after you have reached the last logical statement in the try/catch block.

The RTTI library files also provide support for dynamic casts. For example, without the RTTI library, eMbedded Visual C++ 4.0 will report a linker error with the following code: struct A

{   int a;    A : a(1) {} virtual ~A {} // All the rest of destructors will be virtual. };

void Test

{  A a;    A* a4 = dynamic_cast<A>(&a); } The linker error looks similar to the following:

error LNK2001: unresolved external symbol &quot;const type_info::`vftable'&quot; (??_7type_info@@6B@)

error LNK2019: unresolved external symbol ___RTDynamicCast referenced in function &quot;void __cdecl Test(void)&quot; (?Test@@YAXXZ)

The dynamic cast code builds successfully with the inclusion of the RTTI libraries in the project.

Additional query words: type_info CPPEH eVC eVC++

Keywords: kbinfo KB830482

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.