Mail Archives: djgpp-workers/1998/10/19/10:14:49
The stub mechanism allows ANSI functions to call non-ANSI functions
without polluting the ANSI namespace. For example, some ANSI function
might need to call pow2() for something, but pow2() isn't ANSI. The
stub #defines pow2() to be __pow2() in stubs.h and provides a jump
(stub*.s) for the old name. This way, when the ANSI function calls
pow2() it's really calling __pow2(), but if a user program calls
pow2() it really calls pow2(), which is the stub, which jumps to
__pow2().
However, if the user provides their own pow2() function that's
different than ours (maybe it prints "pow!" twice), the ANSI function
that wanted *our* pow2() will still work.
That's what the libc stub mechanism is for.
- Raw text -