ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


I have tried to make my own implementations of standard C library functions memcpy, memmove, memcmp, strcpy, and strcmp. I did not suceed. How can I replace these functions with my own variants?


The functions memcpy, memmove, memcmp, strcpy, and strcmp have a special parameter passing method to pass all parameters in registers. Additionally, these functions are available in different variants for CPUs with multiple DPTR registers.

Struct assignments use the memcpy function, but without an explicit function call and without the need for the header file. Therefore, memcpy is implemented via the entry ?C?COPY and is used for both struct assignments and the memcpy function.

To replace these functions with your own, you must use a function name that is different from the ANSI standard. To avoid rewriting existing source code, you may change the string.h header file as shown below for the strcmp function:

extern char my_strcmp (char *s1, char *s2);
#define strcmp my_strcmp  // replace strcmp function with my_strcmp

Article last edited on: 2001-08-07 00:00:00

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential