delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/10/19/10:14:49

Date: Mon, 19 Oct 1998 10:14:46 -0400 (EDT)
Message-Id: <199810191414.KAA25670@indy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
In-reply-to: <362B459B.4A66C6A3@cyberoptics.com> (message from Eric Rudd on
Mon, 19 Oct 1998 08:58:51 -0500)
Subject: Re: libc math function upgrade work
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019