MORE INFORMATION
An attempt to call, from the Command window, a function that does not
have any symbolic information fails and CodeView generates an error
message. In CodeView versions 4.0x, 4.1, and 4.25, the error is as
follows:
CXX0017: Error: symbol not found
CAN0017: Error: symbol not found
In CodeView versions 3.x, the error is as follows:
CV1017 Error: Syntax error
CodeView versions 2.x display an "unknown symbol" error in the Command
window.
An attempt to add to the Watch window a function that does not have
any symbolic information fails and CodeView generates an error
message. In CodeView versions 4.0x, 4.1, and 4.25, the error is as
follows:
CXX0030: Error: expression cannot be evaluated
CAN0030: Error: expression cannot be evaluated
CodeView versions 3.x ignore the entry and sound the system bell.
CodeView versions 2.x generate an "unknown symbol" error.
The Advanced Programming Techniques manual provides an example of
calling a function in the C run-time library from the Command window
with the following command:
This command invokes the function and displays its return value in the
Command window. To add the function to the Watch window, use the
following command:
Another method to add a function to the Watch window is as follows:
choose Add Watch from the Watch menu. Type the function name, a left
parenthesis, the argument list, a right parenthesis, and choose OK.
Neither "w" or "?" is required in this situation.
If the function required any input or produces any output, the screen
flip/swap option on the Options menu must be selected.
To call a function in the C run-time library, a function in the
Windows application programming interface (API), or any other function
that does not contain CodeView symbolic information, you must write a
shell function that calls the desired function and passes along the
value it returns.
For example, to call the sqrt() function in the C run-time library
from the CodeView Command or Watch window, create a shell function
that looks like the following:
Sample Code
/*
* Compile options needed: /Zi
*/
#include <math.h>
double my_sqrt(double x)
{
return sqrt(x);
}
Compile this function and link it into your application (be sure to
specify the /CO[DEVIEW] LINK option). Your application does not need
to call my_sqrt() for the function to be available for direct
execution. However, before calling my_sqrt() from the Command or Watch
window, you must step into the main() function to initialize the
program's stack.
To run the my_sqrt() function from the Command window, type the
following:
CodeView displays the value returned by the function on the next line
in the Command window. In this example, CodeView displays
2.0000000000000, the square root of 4.0.
To add the my_sqrt() function to the Watch window, type the following
in the Command window:
To add the my_sqrt() function to the Watch window using the Add Watch
command on the Watch menu, type the following at the Add Watch prompt:
CodeView executes each function in the Watch window each time it
updates the Watch window.
Even though these examples use a constant value for the function
parameter, you can specify any variable that is currently in scope.