Dear StackOverflow Community,
I am working on a personal project where I need to intercept Linux API like open()
, read()
etc, and I would like to do some data analysis on that, and I would need to keep a C++ data structure std::map
in the library that will be updated in a thread safe manner.
Since I want to use C++ std::map
I was thinking of writing the library (*.so) to preload using C++ and the functions to intercept will be prepended with extern "C"
to prevent name mangling of the C++ compiler.
But is it the right approach? Should I write the shared library purely in C and implement the map data structure from scratch?
Please do reply and every help will be greatly appreciated 🙂