From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-07-24 21:59:48


From: Andy Glew <glew_at_[hidden]>
> Before BOOSTing them, I'd like to find a non-intrusive way of doing this.
> I can do it standardly in Borland C++ --- the only C++ manuals I had this weekend.

There is no portable non-intrusive way.

> There may be some sort of pre and post destructor hook.

Not in the standard.

> But I think that this shows a more important issue: there is no portable way
> of wrapperizing functions that do not have hooks planted a priori.

Sure enough.

> I.e. what I want to do is take an arbitrary existing library function foo(),
> write my own library function foo() that intercepts all existing calls to foo(),
> which typically does some work, and then may optionally call the original
> function foo().

That would be quite a trick, although you might could do it at link time on
some systems with the right shenanigans.