Re: Linking gcc compiled binaries and non-gcc libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vardhan,

GCC and other compilers, such as Sun or AIX, can cross-link C ABI.

GCC and other compilers, such as Sun or AIX, cannot cross-link C++ ABI.

If you need to cross-link to a C++ library you need to create a C API thunk
layer to bridge from GCC C++ to Sun or AIX C++.  You¹ll need to compile the
Sun or AIX side of the C API thunk to the Sun/AIX C++ code with the Sun or
AIX compiler.  Then your GCC C++ code needs to use the C API thunk.

The C API thunk is responsible for marshalling parameters (if they are more
complicated than a plain old data type, such as a std::vector), and for
handling exceptions that may arise on the Sun/AIX C++ side of the fence.

Other issues that may arise is if the Sun/AIX C++ library uses C++ I/O.
Even moreso if that C++ I/O object is used in its API -- that makes things a
lot more difficult.

This is not a GCC issue.  Rather, it is the lack of a C++ ABI standard to
which the various C++ compiler vendors can comply.  (There is a C ABI
standard for almost all platforms specified by the respective platform¹s OS,
to which all the various C compiler vendors do comply.)

HTH,
--Eljay



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux