Search code examples
c++gccdynamic-library

Can Program Compiled by G++ 4.1 Invoke The Library Compiled by G++ 2.0 directly?


I need to upgrade the Compiler(very old code, from g++ 2.0 to 4.0) for our project. However, our project use some 3rd library(only own the binary). Must I rebuild them with the new compiler, or I can still invoke the old binary directly.

Anyone know about this,please be kind enough to help me.

Thanks


Solution

  • It will not work:

    • g++ 2.0 does not use a standard ABI [1];
    • g++ >=3 use the Itanium ABI [1];
    • there is no option to switch back to the old non-standard ABI [2].

    [1] « The GNU C++ compiler uses an industry-standard C++ ABI starting with version 3 » http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html

    [2] http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-fabi-version-144