I would like to force an error or warning if I call a certain function from a third-party lib because I want to avoid needing reviews to make sure we do not call that function.
Google gives me very old StackOverflow answers to that problem at the top (e.g. Can I force a compiler error if certain functions are called?) which are based on adding #defines or #deprecated hints in the code which are based on preprocessing, but to avoid any weird issues with the naming there I was wondering whether there is any modern possibility to actually tell the linker that I want to link against library libfoo, but please error out if someone in my code links against a specific call in libfoo.
NOTE: This is not meant as a security protection against a malevolent actor, I only want to automate the process of detecting that we call that function by accident.