BUG: You receive a "C1001" compiler error message when you compile code that has one __hook function after another __hook function in Visual C++ .NET 2003 (829749)
The information in this article applies to:
- Microsoft Visual C++ .NET (2003)
SYMPTOMS In Microsoft Visual C++ .NET 2003, when you try to compile code that has one __hook function after another __hook function , you receive the following compiler
error: fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 2701) Please choose the Technical Support
command on the Visual C++ Help menu, or open the Technical Support help file
for more information.
CAUSEThis error is a bug in the Visual C++ 2003 compiler. Because of this bug, the compiler cannot correctly parse your source
code because of the layout of your code.RESOLUTIONThis bug has three possible workarounds: - Add some code between the two __hook function calls.
To do this, follow these steps:
- In Solution Explorer, under the Source
Files folder, double-click the Hook.cpp
file.
- Locate the following statement in the code window:
// This is the first workaround. - Uncomment the statement after the statement that you
located in step 2, and then press
CTRL+SHIFT+B to build the solution.
- Move another function (such as the CGraph::OnDataChanged
function) between the two constructor calls.
To do this, follow these
steps:
- In Solution Explorer, under the Source
Files folder, double-click the Hook.cpp
file.
- Locate the following statement in the code window:
// MoveCodeHere - Locate the following statement in the code window:
// The second workaround is to move this function to the "MoveCodeHere" region. - Move the function that you defined after the statement
that you located in step 3 to the region that you located in step
2.
The code window now includes the following code example:
CMyGraph::CMyGraph(CMyGraphData& graphData) :
m_GraphData(graphData)
{
// Comment the following code for the third workaround:
__hook(&CMyGraphData::DataChanged, &m_GraphData, &CMyGraph::OnDataChanged);
// Uncomment the following code for the third workaround:
// CMyGraph::HookEvent();
}
// MoveCodeHere
void CMyGraph::OnDataChanged(CMyGraphData& source)
{
}
CMyGraph::CMyGraph(const CMyGraph& other) :
m_GraphData(other.m_GraphData)
{
// If you uncomment the following line, compilation succeeds:
// This is the first workaround.
// int x = 0;
// Comment the following code for the third workaround:
__hook(&CMyGraphData::DataChanged, &m_GraphData, &CMyGraph::OnDataChanged);
// Uncomment the following code for the third workaround:
// CMyGraph::HookEvent();
}
// The second workaround is to move this function to the "MoveCodeHere" region.
- Press CTRL+SHIFT+B to build the
solution.
- Put the __hook function call into its own inline function, and then call the inline
function instead of calling the __hook function directly.
To do this, follow these steps:
- In Solution Explorer, under the Source
Files folder, double-click the Hook.cpp
file.
- Locate the following statement in the code window:
// Third Workaround: - Uncomment the function code that is after the statement that
you located in step 2.
- Locate all the occurrences of the following statement in
the code window, and then comment the line after this statement:
// Comment the following code for the third workaround: - Locate all the occurrences of the following statement in
the code window, and then uncomment the line after this statement:
// Uncomment the following code for the third workaround: - Press CTRL+SHIFT+B to build the
solution.
You incur no overhead by using this workaround because, in
the release configuration, the compiler will replace every occurrence of the HookEvent function call with the associated function body.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.REFERENCESFor more information, visit the following Microsoft Web
sites:
Modification Type: | Minor | Last Reviewed: | 1/16/2006 |
---|
Keywords: | kbCompiler kbHook kberrmsg kbbug KB829749 kbAudDeveloper |
---|
|