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

Caleb Tennis caleb at aei-tech.com
Mon Jan 22 18:38:01 UTC 2007


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.




More information about the Kde-bindings mailing list