2012/8/8 niXman

> 2012/8/8 Ruben Van Boxem:
> > That's not what was implemented. What was implemented is the
> > native (MSVC compatible?) Win64 native exception handling.
> Why Win64? SEH that, only for Win64 is implemented/works?
>
> P.S.
> Probably my questions seem silly, but I never worked for windows.
> Some years I work as the programmer for Linux, and never thought about
> on how are implemented an exceptions and how many implementations
> exist =)
>

It's not silly, it's actually quite a tale:
0. For MSVC, there are three exception handling models:
http://msdn.microsoft.com/en-us/library/1deeycx5%28v=vs.110%29.aspx
1. SEH for C++ exceptionsas implemented in MSVC for 32-bit is patented.
2. Win64 exception handling is half-documented, and is based on this family
of functions: http://msdn.microsoft.com/en-us/library/ms680615%28v=vs.85%29which
are only supported on Win64 (as you can see on that msdn page)
3. GCC has several exception handling models, among which dw2 and sjlj.
 - dw2 is used on Linux as it is something called "zero-cost exception
handling". This means before a C++ "try" block is entered or a function is
called, nothing needs to be done at runtime. The compiler can generate all
necessary stack unwind info at compile time.
 - In the sjlj model, which MinGW-w64 recommended for both 32 and 64 bit,
requires a preparation function each time a function is called and/or a try
block is entered. This is not "zero-cost".
 - dw2 exceptions cannot propagate through foreign (MSVC compiled) code, so
you could not throw a dw2 exception across a Microsoft compiled DLL.
 - sjlj exceptions work in this use case. dw2 ex
4. Win64 eh is very similar to dwarf exceptions, it is also a "zero-cost"
model (often implemented as "table based" eh).

There are other implementations and details I'm getting wrong or omitting,
but this is the story I keep in my head.


>
>
> > It is something like the dw2/sjlj eh, but better: it allows MSVC-code
> > originating exceptions to be thrown over GCC generated code and I would
> > guess vice versa. sjlj does this as well, but this seh does it without
> > performance penalty.
> What it is more preferable to development for windows?
>

see above, dw2 vs sjlj is a performance vs
throw-exceptions-across-foreign-code tradeoff.

Whether it is possible to argue, what SEH always the most preferred choice?
>

The Win64 SEH based C++ EH is always preferred. It is superior to dw2
because it works on x64, and to sjlj because it is a "zero-cost" model as
you can find explained elsewhere.


>
>
> > I have, and Jon_y has built a multilib compiler.
> It is necessary to build in some stages?
> 1) all-target-libgcc
> 2) all-gcc
> 3) all
>
> I am right?
>

I didn't need to do anything special, so I don't think so. You can
cross-compile in the following way:

1. headers+binutils
2. all-gcc
3. crt
4. rest of gcc (including libgcc)

Cheers,

Ruben

PS: if I said something completely wrong, please correct me!


>
> P.P.S.
> Please, delete my e-mail when answering ;)
> Thanks.
>
> --
> Regards,
> niXman
> ___________________________________________________
> Dual-target(32 & 64 bit) MinGW compilers for 32 and 64 bit Windows:
> http://sourceforge.net/projects/mingwbuilds/
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to