1

I am building multiple dynamic libraries for a project. I want to build the entire project with c++11. While building the libraries I explicitly specify the CXX and C Flags. I am using CMAKE 3.5 to build the libraries. I specify the c++11 or gnu11 version while building each module, something like

-DCMAKE_C_FLAGS="-std=gnu11" -DCMAKE_CXX_FLAGS="-std=c++11"

I wanted to verify once the libraries were build that they use c++11 runtime, Is there any way I can double check?

  • You don't have to verify anything. Unless a binary-ABI compatible runtime is present, the libraries will not load at all, as long as your operating system knows how to do its job properly. – Sam Varshavchik Mar 27 '17 at 14:46
  • @SamVarshavchik The libraries that I am building do not give me any errors during compile-time but during runtime I am getting unknown stack corruptions exception, so I wanted to double check on the runtime they are picking up. Something like http://stackoverflow.com/questions/33407016/how-to-tell-a-library-was-compiled-using-c11 – Umang Mukesh Mehta Mar 27 '17 at 14:52
  • Making random guesses as to the cause of corruption/crashes is not likely to have productive results. All modern operating systems refuse to load shared libraries with ABI mismatches. There is no explicit way to verify, somehow, in some magical way, whether the runtime C++ library has C++11 support. The operating system checks that itself. That's part of its job. If the library does not provide C++11 support, all the C++11 classes, symbols, etc..., are missing, the code won't run at all. – Sam Varshavchik Mar 27 '17 at 15:56
  • The question you need to ask is not whether it was compiled with a particular version of C++, but whether it is compiled with a standard library that is compatible with what you're currently using. – Nicol Bolas Mar 27 '17 at 16:57
  • 2
    @SamVarshavchik If two components are linked against two different runtimes, an OS will happily load both, which may or may not crash your program. – n. m. could be an AI Mar 28 '17 at 04:46
  • This is highly compiler and OS dependent. – n. m. could be an AI Mar 28 '17 at 04:49

0 Answers0