0

If I will compile something (x.cpp) with clang++ and generate dynamic link library, let's say x.so files and I will use that .so files in other source (y.cpp) which I am compiling using g++, so do I get any run time error.

halfer
  • 19,824
  • 17
  • 99
  • 186
Parag Jain
  • 612
  • 2
  • 14
  • 31
  • 6
    Try it and tell us. – Evg Jan 07 '20 at 07:21
  • 1
    Might search for 'ABI' – tjysdsg Jan 07 '20 at 07:23
  • 2
    In calling a DLL made with a different compiler, you are bravely entering a world where many different things can happen. See [Using C++ DLLs with different compiler versions](https://stackoverflow.com/q/331045/10871073) for some possibly helpful tips. – Adrian Mole Jan 07 '20 at 07:24
  • 4
    This is known to break with different versions of the same compiler, let alone different compilers. – Gaurav Sehgal Jan 07 '20 at 07:25
  • 2
    Mixing different compilers in the same project is very dangerous. Why do you have this requirement? Is it an option to compile everything with clang++ instead? – Botje Jan 07 '20 at 10:11
  • no like my whole code is under g++ but now i am adding one cpp files which is using some "armnn" DLL which are build in clang++. so i need to run that cpp with clang++ otherwise i am getting runtime crash. and i can not complie whole armnn library in g++ – Parag Jain Jan 07 '20 at 10:13
  • So why not compile everything with clang++? – Botje Jan 07 '20 at 10:14
  • mostly works if and only if it's same version C++ and -pedantic and other generalizing arch./machine options –  Jan 07 '20 at 11:59

0 Answers0