Compile Errors when Stubbing Built-in Library Functions

Issue:
I get a compiler error when I try to build the test harness with built-in library functions stubbed
Solution:

A user may wish to stub a C built-in library function using the Library Stubs. If the name of the stubbed function is used elsewhere in the user's code for a different purpose, such as for a variable declaration, then a compiler error will likely result when VectorCAST tries to build the test harness. This may be avoided by letting VectorCAST know (via a defined variable) that only the built-in function should be replaced by a stub. You would define a variable as follows:
 

VCAST_ONLY_RENAME_FUNCTION_<variable_name>, where <variable_name> is the name of the built-in function/variable causing the compiler error.
 

For example, if you wish to set the read function as a stub, you could do this by following procedures in referenced link. If you have a variable or user function named read you may get a compiler error, unless you define the following variable in your test environment:
 

VCAST_ONLY_RENAME_FUNCTION_read
 

You could define this by going to Tools | Options | C/C++ Preprocessor/Compiler Tab, and adding to the Defined Variables input area.



Article ID: 1465
Last updated: 2019-10-24
Revision: 4
VectorCAST -> C++ Unit Testing -> Compile Errors when Stubbing Built-in Library Functions
https://kb.vector.com/entry/1465/