[Python-Dev] Problems with Python's default dlopen flags

David Abrahams David Abrahams" <david.abrahams@rcn.com
Sun, 5 May 2002 18:46:00 -0500


----- Original Message ----- 
From: "Gordon McMillan" <gmcm@hypernet.com>


> On 5 May 2002 at 16:01, David Abrahams wrote:
> 
> > From: "Gordon McMillan" <gmcm@hypernet.com>
> > 
> > > There is some strangeness to exceptions, Linux, gcc
> > > and linking. In scxx (my minimalist C++ / Python
> > > interface), there's no separate .so involved - the
> > > scxx code is compiled in with the extension. There
> > > are no statics involved, so C linkage works (you
> > > don't need a relinked Python). At a certain gcc
> > > release, exceptions thrown and caught at the top
> > > level 
> > 
> > What does "at the top level" mean?
> 
> The function is an entry point. I think eric diagnosed
> it as simply throw / catch at the same level. Throwing
> in a called function & catching in the caller worked
> fine for both of us.

Are you saying that the following prints "fail"?

#include <iostream>

void init_mymodule()
{
    try {
        throw "hello";
    }
    catch( char const*) {}
    catch(...) {
        std::cout << "fail";
    }
}

but that this does not?

#include <iostream>
void throw_hi() { throw "hello"; }
void init_mymodule()
{
    try {
        throw_hi();
    }
    catch( char const*) {}
    catch(...) {
        std::cout << "fail";
    }
}