C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Interceptor Function (preserve stack and all registers)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 26 Jul 2024 08:13:02 -0700
On Friday 26 July 2024 03:22:24 GMT-7 Frederick Virchanza Gotham via Std-
Proposals wrote:
> auto Func(auto) interceptor
> {
> WriteLog( "Function called 'FlushPipe'");
> auto const h = LoadLibraryA("monkey.dll");
> auto const pf = (void(*)(void))GetProcAddress(h, "FlushPipe");
> goto pf;
> }

Actually, scratch my other replies. You've just described ltrace:
https://ltrace.org/
https://man7.org/linux/man-pages/man1/ltrace.1.html

There's no need to have any of this in the language. What you need is tooling.

If your vendor or OS does not provide you with the developer tooling you need,
make a feature request with them. That has a far better chance of being
implemented than a fragile language feature that is needed by half a dozen
people in the world, once a decade. And in particular one where the
implementations will raise valid questions as "already solved in my OS".

Or shop for third-party content which may exist in your OS.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-07-26 15:13:05