This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++/dlerror/pthread problem


>>>>> On Thu, 31 Jul 2003 16:28:01 +0200, Thorsten Kukuk <kukuk@suse.de> said:

  Thorsten> The appended example program works fine, if not linked
  Thorsten> against libpthread or if it is compiled as C program. But
  Thorsten> as C++ program linked against libpthread, it will
  Thorsten> seg.fault in dlerror().

  Thorsten> Does somebody know why? I know it is a bad idea to call
  Thorsten> dlerror() without any other dl* call before, but people
  Thorsten> are doing so ...

Here is a possibility: depending on platform and exact version of
libpthread, here is what happens: you link (and build) against
libpthread, which will give you an "errno" that references a field in
the thread descriptor.  But since you never actually do any pthread
calls, the thread descriptor for the main thread never gets set up.
Thus, any attempt to use errno will cause a segfault.  This is known
to happen on ia64 with LinuxThreads.  NPTL is fine, as far as I know.

	--david


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