C++ Logo

std-discussion

Advanced search

Re: how to use ld_preload to intercept c++ program?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 24 Feb 2025 11:06:19 -0300
On Monday, 24 February 2025 07:01:49 Brasilia Standard Time longguang.yue via
Std-Discussion wrote:
> HI, all:
> Is there a mechanism or standard to use ld_preload to intercept c++
> program?

Hello longguang

This is the wrong mailing list for that type of question. This mailing list is
to discuss the C++ Standard as it currently exists, not for general help with
C++ topics. Shared libraries are not a concept in C++ and intercepting symbols
is not an acceptable behaviour in C++.

Your question belongs in a mailing list or forum of your specific operating
system. In particular, your issue depends on how your C++ standard library
vendor implemented the operations you want to intercept: on Linux, for
example, there are many different version of the open(2) system call (open,
openat, openat2). It also depends on how the particular vendor compiled the
library in question: they may have decided that no one should intercept and
done extra optimisation that makes intercepting impossible.

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

Received on 2025-02-24 14:06:22