public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: 孙世龙 <sunshilong369@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Linking to dynamic libraries compiled by old version g++
Date: Tue, 8 Nov 2022 11:03:11 +0800	[thread overview]
Message-ID: <CAAvDm6ZBxZKCyVX21Y8Hj-paXaSrtXwMkrSvvEYxdTHuAJafjw@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdS-q5m-83Kt8k6GAaFUcLqn+RbMbVR9CCpepST8+xZ6nA@mail.gmail.com>

> Specifically, there were changes to std::chrono::system_clock, and
>std::error_category, and std::condition_variable.
>If those types are used in the old dynamic libraries, particularly
>across the library API boundary, then you are likely to run into problems.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If the aforementioned types are only used in the implementation of the library
which is compiled with 4.9.4 and the interface of the library is a C
interface.

If I understand you correctly, there is no potential problem if a binary program
is compiled with g++11.0.3 and is linked to the said library. Am I right?

Best regards

On Mon, Nov 7, 2022 at 9:02 PM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Mon, 7 Nov 2022 at 02:11, 孙世龙 via Gcc-help <gcc-help@gcc.gnu.org> wrote:
> >
> > There are dynamic libraries provided by others, which are out of my control.
> >
> > What I know is that most of the aforementioned libraries are compiled
> > by g++4.9.4 & g++4.8.4 with C++11 support, and some libraries are
> > compiled by g++11.1.0 with C++14 support.
> >
> > And I have to use newer g++ which supports C++17 to compile my
> > project. I intend to use g++11.3.0 on Ubuntu20.4.
> >
> > Is there any potential problem I should be aware of when linking to
> > dynamic libraries compiled by the said old version g++ ?
>
> Yes, this is not supported.
>
> C++11 support in GCC 4.8 and 4.9 was experimental and unstable, and is
> not ABI compatible with C++11 code compiled by GCC 5 or later.
>
> Specifically, there were changes to std::chrono::system_clock, and
> std::error_category, and std::condition_variable. If those types are
> used in the old dynamic libraries, particularly across the library API
> boundary, then you are likely to run into problems. There are probably
> other incompatibilities that I'm forgetting. I don't bother to
> remember all the incompatibilities, because what you're trying to do
> is not supported and so I don't spend any effort memorising all the
> ways it can fail.

      reply	other threads:[~2022-11-08  3:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07  2:10 孙世龙
2022-11-07 13:02 ` Jonathan Wakely
2022-11-08  3:03   ` 孙世龙 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAvDm6ZBxZKCyVX21Y8Hj-paXaSrtXwMkrSvvEYxdTHuAJafjw@mail.gmail.com \
    --to=sunshilong369@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).