• Alexey Pushkin

    Alexey Pushkin - 2009-02-24


    does _set_se_translator()
    really work with mingw-w64 ?

    Like I can throw G++ exceptions from the _se_translator_function ?!

    • Kai Tietz

      Kai Tietz - 2009-02-24

      At the moment it won't work, because we haven't support of SEH for x64 (nor for ia32) in gcc at the moment.
      We plan to add this feature for x64 while gcc 4.5 phase 1/2.


    • Alexey Pushkin

      Alexey Pushkin - 2009-02-25

      Thank you !

      • NightStrike

        NightStrike - 2009-02-25

        It might not be a bad idea to put this in as a feature request so we don't forget about it.  I would do it myself, but I think you know more about it than I do :)

    • Alexey Pushkin

      Alexey Pushkin - 2009-02-25

      > but I think you know more about it than I do :) 

      I wouldn't say I know that much about it.

      From the programmer's prospective it will be somewhat
      similar to being able to throw exceptions from a signal handler
      (which is not possible).
      I don't know how useful, but at least interesting :-)
      That's why I asked :-)

  • chopin952

    chopin952 - 2011-05-30

    Hello all. Great tools! Thanks.

    I'm replying to this old thread wondering if set_se_translator is working yet. When I try to use it, my program compiles fine but I get the following link error:
    undefined reference to `_imp___Z18_set_se_translatorPFvjP19_EXCEPTION_POINTERSE'

    I did a strings search on all libraries, and the function does show up in libmsvcr90 and libmsvcr100. However, the mangling is different and I would say correct in the libs,but not correct for my project.

    It seems as if from the point of view of my .cpp file it doesn't know the exact signature of the function.
    Is this an include issue, a code generation issue, or something else? I'm including <eh.h>.

    Any hints would be appreciated.

    I've tried different tool chains from the download section all with the same results:
    gcc version 4.5.2 (GCC)
    gcc version 4.6.1 20110506 (prerelease) (GCC)
    gcc version 4.7.0 20110517 (experimental) (GCC)

  • chopin952

    chopin952 - 2011-06-04

    I looked in the source distribution .def files and it looks like it should be working.
    The conversion between GNU mangling and the MSVCRT mangling looks fine.

    ; void (__cdecl*__cdecl _set_se_translator(void (__cdecl*)(unsigned int,struct _EXCEPTION_POINTERS * __ptr64)))(unsigned int,struct _EXCEPTION_POINTERS * __ptr64)
    ; GNU = __Z18_set_se_translatorPFvjP19_EXCEPTION_POINTERSE

    Is there anything else I could be doing wrong?
    Thanks all.

  • Pawel Sikora

    Pawel Sikora - 2011-06-04

    _set_se_translator is a part of visual runtime and it doesn't work for me. you should use gcc-4.6+ and veh, e.g.:

    #include <stdexcept>
    #include <cstdio>
    #include <cstdlib>
    #include <windows.h>
    #include <winbase.h>

    ::LONG CALLBACK vectoredExceptionHandler( ::PEXCEPTION_POINTERS ep )
            std::printf( "entering vectorized ex. handler 0x%lx…\n",
    ep->ExceptionRecord->ExceptionCode );

    ::LONG WINAPI unhandledExecptionFilter( ::PEXCEPTION_POINTERS ep )
            std::printf( "entering unhandled ex. filter 0x%lx…\n",
    ep->ExceptionRecord->ExceptionCode );
            return EXCEPTION_EXECUTE_HANDLER; // should terminate process.

    int main()
            ::AddVectoredExceptionHandler( 1, vectoredExceptionHandler );
            ::SetUnhandledExceptionFilter( unhandledExecptionFilter );
                    int i = 42;
                    std::printf( "throwing int %d…\n", i );
                    throw i;
            catch ( int i )
                    std::printf( "catching int %d…\n", i );
            volatile int* p = 0;
            std::printf( "accessing null pointer…\n" );
            *p = 0;
            return 0;


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks