gcc - how to override functions from stdlib -


i override strcpy , supply own implementation, in strcpy want , call original strcpy. how can that?

i'm working on linux, compiling gcc, read built in functions provided gcc, i'm not sure if that's way need, tried use flag -fno-builtin-strcpy, , in strcpy call __builtin_strcpy, somehow doesn't work expected , cause problemes:

char *strcpy(char *dest, const char *src) {     if(......)     {           ----do something---     }       return __builtin_strcpy(dest,src);  } 

i guess might able playing linking order or excluding standard libraries not that. if sw has long life , multiple maintainers, there maintenance problems @ point.

why don't create new strcpy instead?

char *my_new_strcpy(char *dest, const char *src) {     if(......)     {           ----do something---     }      return strcpy(dest,src);  } 

and use need. or not meet requirements?


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -