This is the mail archive of the libstdc++@sources.redhat.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Q: libio and stream in stdc++


hi,
so I've to track down the dlopen (aka. java's System.Loadlibrary bug).
finaly it's turn out that the problems comes from this stack trace:
------------------
std::ios_base::Init::Init(void)
std::basic_filebuf<char, std::char_traits<char> >::basic_filebuf(int, char const
*, std::_Ios_Openmode)
std::__basic_file<char>::sys_open(int, std::_Ios_Openmode)
------------------
there is NOT any system call in sys_open (!!) that's the most strange
thing for me, so what can cause the problem ?
ios_base::Init::Init run once when the library loaded (as a class's
static variable initialization) and initialize cin, cout, cerr.
this is another interesting problem anyway, since there are some
application which does NOT use any streaming facilities of stdc++
or at least not use cin, cout... ie. server's and those apps/libs 
which doesn't have a tty.
so why I _always need to run ios_base::Init::Init ?
I suppose if I simple not run this function on stratup, than I won't 
have cin... (I don't need it anyway), but at least stdc++ will work 
(unfortunately this was a bad assumption).
when I recompile the stdc++ so that I modify ios_base::Init::Init to
catch all exception. but it's not help, there are some low-level 
signal which cause the crash, so I recompile again not to run 
ios_base::Init::Init at all, than at least the shared library was 
loaded and seems to work, but ASAI try to open a file (even for 
read) another crach happend in:
------------------
std::basic_ifstream<char, std::char_traits<char> >::~basic_ifstream(void)
std::basic_filebuf<char, std::char_traits<char> >::~basic_filebuf(void)
std::basic_filebuf<char, std::char_traits<char> >::close(void)
------------------
this last function was marked in docs/17_intro/CHECKLIST as:
X - Partially implemented, or buggy. 
may be that's the problem.
since I can't find any solution I try STLport. than I surprise that
everything are works even from java.
so the question: what is the main difference between stdc++'s and 
stlport's io library ? I know stlport is based on sgi's experimental
io library, but this wouldn't have to be a problem, I assume both
use glibc or system call's to perform io operation.
the strange thing if I only use out shared lib from c or c++ with 
the same c/c++ compiler then the stdc++ library works fine. when I 
try to use it from java stdc++ crash. I know (from java-linux list, 
since it was a major problem with earlier jdk) that java vm use _an_ 
stdc++ library which is staticaly compiled into the vm. I assume 
it's an older v2 one, but I don't know whether it can cause such a 
bug (can I use 2 different stdc++ in a same process?) but than why 
I can use stlport.
I assume there are some low-level io difference, but what can be this ?
I'm wiiling to spend some time so correct this problem, but is there
anybody who has any advice ? how can I track down the problem ?
I can't debug stdc++ from java:-( any tipp how can I reproduce this
bug just use  c/c++ ? how can I compile debug version of stdc++,
is there any configure option for this ?
thanks.

ps. I cc this mail to dietmar since he's wellknown iostream expert
even he is not realy connected to the stdc++ development.

 -- Levente                        http://petition.eurolinux.org/index_html
 "The only thing worse than not knowing the truth is
  ruining the bliss of ignorance."

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]