#85 Call to wxWidgets DLLs fail when compiling with GCC 4.5.2


The message

Application failed to initialize properly (0xc0000005)

is displayed when attempting to run wxHaskell programs, when wxWidgets is compiled with GCC 4.5.2

DependencyWalker indicates that this happens at the first call to a wxWidgets DLL function:

DllMain(0x6A540000, DLL_PROCESS_ATTACH, 0x0022FD30) in "WXBASE295U_GCC_CUSTOM.DLL" called.
Second chance exception 0xC0000005 (Access Violation) occurred in "NTDLL.DLL" at address 0x7C9673BE.

When wxWidgets is compiled with GCC 3.4.5, no Access Violation message appears.

An explanation might be, that the DLL interface for GCC 4.5 is different, see the following snippet from include\wx\dlimpexp.h:

# elif defined(GNUC) && !wxCHECK_GCC_VERSION(4, 5)
# define WXEXPORT attribute((dllexport))
# define WXIMPORT attribute((dllimport))


Item Version
OS Windows XP
GHC 7.6.3
wxWidgets 2.9.5
wxHaskell (currently in Github repository)
GCC 4.5.2


  • Henk-Jan van Tuyl

    A possible solution is, to adapt wxHaskell to wxWidgets, compiled with GCC >= 4.5, no checking of the GCC version during installation of wxHaskell.

  • Henk-Jan van Tuyl

    The solution is now on GitHub; the problem is solved by adding linker options for C software (in package wxc, file Setup.hs), making it possible to use GCC >= 4.5 for compilation of wxWidgets

  • Henk-Jan van Tuyl

    • Description has changed:


    --- old
    +++ new
    @@ -1,4 +1,3 @@
     The message 
     >  Application failed to initialize properly (0xc0000005)
    • status: open --> closed-fixed

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks