LD_PRELOAD with several source files
-
10-06-2021 - |
Question
I writed LD_PRELOAD module, all my sources are in source.cpp
, but now i need to add crypt.cpp
file with some classes i need, how can i compile LD_PRELOAD via g++ using more that one .cpp file?
Thanks!
Solution
If your command to build the preload library was:
g++ -fPIC -shared -o preload.so source.cpp
then you would change it to:
g++ -fPIC -shared -o preload.so source.cpp crypt.cpp
i.e. you simply add the name of the file to the end of the command line compiling the .cpp files.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow