KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q40738: C memcpy and Large Model

Article: Q40738
Product(s): See article
Version(s): 5.10
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# G881031-5486 | mspl13_c
Last Modified: 16-MAY-1989

Question:

I normally compile a certain program with the /Ox switch. Inside a few
modules, I use the #pragma function(memcpy) statement, to force the
use of the function version of memcpy, which is required because I use
memcpy with some huge pointers.

This works correctly, until I want to use CodeView. At that time, I
recompile with the switches /Od /Zi. This produces the following error
message:

   Error C2164: 'memcpy': intrinsic was not declared

Editing each module to remove the #pragma function(memcpy), which is
not required in the /Od case, eliminates the error message. Editing
the pragma in and out is a lot of work, however.

Why is this required?

Response:

The C2164 error message is listed in ERRMSG.DOC, which is supplied
with the compiler. (It's a good idea to print out all the .DOC files
for reference; there's a lot of important information there that
doesn't appear in the manuals.) 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. An easy way to do this is to
include the appropriate .H file: in this case, either STRING.H or
MEMORY.H will do. This will work with or without intrinsics.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.