INFO: Must Use Prototype Before Intrinsic or Function Pragmas (41212)



The information in this article applies to:

  • Microsoft Visual C++ for Windows, 16-bit edition 1.0
  • Microsoft Visual C++ for Windows, 16-bit edition 1.5
  • Microsoft Visual C++ for Windows, 16-bit edition 1.51
  • Microsoft Visual C++ for Windows, 16-bit edition 1.52
  • Microsoft Visual C++, 32-bit Editions 1.0
  • Microsoft Visual C++, 32-bit Editions 2.0
  • Microsoft Visual C++, 32-bit Editions 2.1
  • Microsoft Visual C++, 32-bit Editions 4.0
  • Microsoft Visual C++, 32-bit Editions 5.0
  • Microsoft Visual C++, 32-bit Editions 6.0

This article was previously published under Q41212

SUMMARY

There are a number of C Run-time routines that have both a function version and an intrinsic version. If the following statement is used in an application to force use of the function version:
   #pragma function( a_CFunction )
where a_CFunction is a C Run-time library routine, the compiler generates the following error:
error C2164: 'a_CFunction': intrinsic was not declared.
if the /Oi option is not used. The same is true for the following statement to force use of the intrinsic:
   #pragma intrinsic( a_CFunction )
When you don't use the /Oi or /Ox option, you need to declare a function prototype before you can use the function or intrinsic pragmas. For example, to properly use the memcpy function in the Sample Code below, either STRING.H or MEMORY.H must be included. Consult the C Run-time documentation for the appropriate header (.H) file to include.

For more information about #pragma intrinsic or C Run-time functions that have intrinsic versions, consult the documentation provided with your Microsoft compiler or development environment.

Sample Code

/* Compile options needed: none
*/ 

#pragma function( memcpy )

char s1[] = "string";
char s2[10];

void main( )
{
   memcpy( s2, s1, 7 );
}

Modification Type:MinorLast Reviewed:7/5/2005
Keywords:kbcode kbCompiler kbinfo KB41212 kbAudDeveloper