Overriding C library functions, calling original

The linker will search the files you provide on the command line first for symbols, before it searches in libraries. This means that as soon as it sees that getline has been defined, it will no longer look for another getline symbol. This is how linkers works on all platforms.

This of course has implications for your fifth point, in that there is no possibility to call the “original” getline, as your function is the original from the point of view of the linker.

For the fifth point, you may want to look at e.g. this old answer.

Leave a Comment