Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 LD_PRELOAD 拦截像这样的原始操作(+、-、% 等)?
int64_t endWhenNsec = startWhenNsec + gTimeLimitSec;
如果没有,有什么方法可以实现类似的东西?
不会。原始运算符直接编译为机器代码。不涉及库,因此预加载库不能改变它们的行为。如果可以的话,那真是一团糟!