[Kde-bindings] Qt's use of global endl

Richard Dale rdale at foton.es
Mon Jan 22 19:04:44 UTC 2007


On Monday 22 January 2007 18:38, Caleb Tennis wrote:
> I've been researching a crash, and I'm wondering if anyone else can
> recreate it:
>
> It seems as though in QTextStream some global methods are defined as
> convenience functions so that you can do this:
>
> QTextStream str(&blah);
> str << "something" << endl;
>
> Where 'endl' is a global function defined in QTextStream so as to give it
> the same workings as the cerr/cout/cin streams of standard C++.
>
> However, I've found that if I load Qt4 qtruby into memory followed by
> another library's ruby bindings, if the second library utilized any
> streamed output with "endl"s in it, the program crashes.  If I load the
> secondary library BEFORE loading Qt4 qtruby, then everything is okay.
>
> In my head I'm not sure why this is; I would have thought that the binding
> to endl (after a "using namespace std;") would have been set at compile
> time so that runtime loading wouldn't matter, but it seems to.
>
> I'm curious if anyone else has seen this or can recreate it?  I can't even
> think of a good way to work around it, if it is truly what's happening
> here.
I don't have much idea about what would cause this. But have you tried linking 
the two C++ libs into one executable without any ruby bindings, and tried the 
same thing? Maybe it only occurs when dlopen() is used to load the libs as 
would happen with ruby extensions.

-- Richard



More information about the Kde-bindings mailing list