I have tried with both 4.4.2 and 4.4.3 gcc to build a c++ application
to run natively (as a 64bit app) on W7 (pro) 64 bit -- but the thing
does not catch thrown exceptions.

The building process (a cross-compiler) was done on freebsd. The
building process proceeds ok (and, in fact, is working for mingw32
cross-builds for WinXP 32bit environments just fine -- exceptions are
caught).

However, when building for x86_64_w64_mingw32 target with mingw64
runtime libs et al, the applications do not catch exceptions (when
running on W7 host).

I shall include the configure options for gcc (which was configured
with single-threaded memory model, dwarf2 exception unwinding etc...),
but in the mean-time the main question I would like to ask is that if
there is anyone out there who is using mingw64 to build native W7
(pro) 64 bit simple (e.g. single-threaded) C++ applications which
throw exceptions and have them unwind using dwarf2 (i.e.
--disable-sjlj-exceptions)? Has it been done?

The C++ code which fails to catch is as follows:

#include <iostream>
#include <stdexcept>

int
main()
{
  try {
    ::std::cout << "about to throw\n";
    throw ::std::runtime_error("boo");
  } catch (::std::exception const & e) {
      ::std::cout << "wam\n";
  } catch (...) {
      ::std::cout << "bam\n";
  }

  return 0;
}

the above is compiled as:
c++ -static  main.cc

the gcc was configured as:

Target: x86_64-w64-mingw32
configure options:
--disable-threads --enable-languages=c++ --disable-sjlj-exceptions
--disable-libgomp --disable-nls --with-system-zlib --disable-libgcj
--target=x86_64-w64-mingw32 --disable-multilib

Thread model: single
gcc version 4.4.3 (GCC) (but was also reproduced with 4.4.2)

the collect/linking order is as follows:
collect2 -Bstatic crt2.o crtbegin.o /var/tmp//ccDhsQqG.o -lstdc++
-lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -luser32
-lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_eh -lgcc -lmoldname
-lmingwex -lmsvcrt crtend.o


The W7 reports that app has asked the runtime environment to terminate
it in the unusual way (I presume it to be the usual thing it spits out
when terminate/abort/etc is done by the app).

Any thoughts would be appreciated.

Kind regards
Leon.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to