简体   繁体   English

将LD_PRELOAD与fstream一起使用

[英]Using LD_PRELOAD with fstream

I am using LD_PRELOAD to overload system() , fopen() etc. and now i want to replace fstream with my own implementation but i don't know where to start. 我正在使用LD_PRELOAD重载system()fopen()等,现在我想用自己的实现替换fstream,但我不知道从哪里开始。 I searched the web but can't find any good examples about overloading parts or a whole of a class. 我在网上搜索,但找不到有关重载部分或整个类的任何良好示例。 Any help would be appreciated. 任何帮助,将不胜感激。

Thanks. 谢谢。

The search term you'll need is "name mangling". 您需要的搜索词是“名称修改”。 Every method of a class has an internal name which is compatible with the platform conventions. 类的每个方法都有一个内部名称,该名称与平台约定兼容。 This name is generated by the compiler. 该名称由编译器生成。

Name mangling is deterministic, so if you implement the same methods they'll have the same mangled names. 名称重整是确定性的,因此,如果实现相同的方法,它们将具有相同的重整名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM