This is the mail archive of the mailing list for the Cygwin project.

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

C++ dll segfault problem


I'm stuck with a problem building dynamically linked versions of
OpenJade, onsgmls etc. ( The
statically linked versions build out of the box and run without
problems. Building the dlls and the dynamically linked versions is
also no major problem, using dllhelpers-0.2.9. However, the
dynamically linked versions segfault *after* they create all output
they should create.

Please keep in mind that this segfault appears nowhere else. The
static Cygwin build is ok. Static and dynamic builds on various other
operating systems and architectures are ok as well. It also does not
affect the function of the programs. This makes me suspect that there
is some weird platform-specific problem during deallocating memory
when the dlls are unloaded on exit.

I've been trying to debug this (I have to admit that my command of C++
is poor and my knowledge about the inner workings of dlls is even
worse). What I see in gdb is that the programs indeed crash in a
destructor. For the heck of it I modified this destructor, removing
the code that frees memory. Sure enough it segfaults in another
destructor. It is as if the memory is long gone at the time where the
code tries to deallocate it.

I've also tried to get some insight from strace. strace in this case
has the unique ability to *prevent* the segfault, so the stack traces
of the statically and dynamically linked binaries are pretty much

Is there any known issue about dlls generated from C++ code? Are there
any tricks to properly debug this situation? Any help is greatly


Markus Hoenicka, PhD
UT Houston Medical School
Dept. of Integrative Biology and Pharmacology
6431 Fannin MSB4.114
Houston, TX 77030
(713) 500-6313, -7477
(713) 500-7444 (fax)

Unsubscribe info:
Bug reporting:

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