Quoting Ian Lance Taylor <ian@xxxxxxxxxxxxxxxxx>: > y2bismil@xxxxxxxxxxxxxxxxxxxx writes: > > > I know this is a long shot, but is there a way to "override" memset, > strcpy, and > > other c string functions without renaming their calls? > > > > Basically at link time, I want to use my own version of memset, strcpy and > a > > select few others. > > Which function calls do you want to override? > > If you want to override calls made in your own code, just provide your > own versions of memset, strcpy, etc. They will be called in > preference to the one in libc. > > If you want to override the calls in libc, then it depends upon what > host you are using. In some cases you can again simply provide the > function yourself. But in some cases the library never calls memset, > etc., it instead calls internal versions to avoid overriding > problems. So, it depends. > > > BTW are there any known problems with -minline-all-stringops. I tried that > and > > for some reason, I was still getting a function call for memset. > > That suggests that you are using an i386 target. Please always > mention what you are using. > > -minline-all-stringops doesn't necessarily eliminate every call to the > string operations, although it tries. There are a number of possible > cases in which gcc will still emit calls to memset. If you provide a > small test case, somebody can probably tell you whether it is a bug or > a case which is not handled. > > Ian > Thanks Ian, So just to confirm, if in a file say: "myreplacements.c", I have ************************************************* void * memset(void * s,char c,size_t count) { /*my code*/ } ************************************************* Then any call to memset WITHIN MY CODE will first be linked with this memset rather than the one in glibc? This occus even if the calling file has included <string.h>? Do I have to include a header of my own, say "myreplacements.h" in each file (i.e. i could modify the make command to use -include myreplacements.h? Thanks, Yamin ---------------------------------------- This mail sent through www.mywaterloo.ca