INF: Must Use Prototype Before Intrinsic or Function Pragmas

ID Number: Q41212

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

In Microsoft C versions 5.0, 5.1, 6.0, 6.0a, 6.0ax, and C/C++ version

7.0, when the statement

#pragma function( memcpy )

is used to force use of the function version of memcpy (required to

support huge pointers, for example), the compiler generates the

following error

error C2164: 'memcpy': intrinsic was not declared.

if the /Oi option is not used.

The same is true for the statement

#pragma intrinsic( memcpy )

More Information:

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. One method is to include the appropriate .h file; for the

memcpy function, this is either STRING.H or MEMORY.H.

Sample Code

-----------

/* Compile options needed: none

*/

#pragma function( memcpy )

char s1[] = "string";

char s2[10];

void main( )

{

memcpy( s2, s1, 7 );

}

Note that in C 5.1, the C2164 error message is listed in ERRMSG.DOC,

which is supplied with the compiler.

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00