[Python-Dev] Linux Python linking with G++?

Skip Montanaro skip at pobox.com
Thu Jul 7 22:35:39 CEST 2005


    >> I believe it's so that people can link in libraries written in C++
    >> and have them initialized properly.

    Dave> Can you give specifics?  What do you mean by "link in?"  Do you
    Dave> mean "statically link into the Python interpreter," or something
    Dave> else?

Probably not.  I'm not a C++ guy.  My understanding is that global (maybe
static?) C++ objects need the help of C++'s version of crt0 to get properly
initialized at program start.  If there is some library with such objects
that happens to get wrapped and dynamically linked into a Python interpreter
that was linked with a regular C linker (and thus had a C crt0), that
initialization wouldn't happen.

    Dave> Boost.Python is a library written in C++ and I've never had
    Dave> trouble using it with a Python executable... until I ran into a
    Dave> Python that was linked with libstdc++!

Sorry, I can't help.  I'm just recounting my remembering of the reasons for
C++ linkage.  Personally, I avoid C++ as much as I can...

Skip


More information about the Python-Dev mailing list