i am trying to override predefined functions such as strcmp, getenv, etc. i already override some of them using LD_PRELOAD options. but i can't override string class, how can i override c++ string class
i already tried something like this;
class string{
char* str;
public:
string (char* str2){
str = str2;
std::cout << str2 << std::endl ;
}
bool operator==(char* str2) {
std::cout << "c++ => " << str << "==" << str2 << std::endl;
return false;
}
compare(char* str2) {
std::cout << "c++ => " << str << "==" << str2 << std::endl;
return 0;
}
};
but it doesn't work i can't print the string that compared or even defined.
compile;
g++ -g -Wall -shared -fPIC -ldl -o bypasscpp.so bypass.cpp
And running program with;
LD_PRELOAD="./bypasscpp.so" ./app