Archive: Math plugin compiled with mingw32 causes an access violation


Math plugin compiled with mingw32 causes an access violation
Normally the ".c" file extension of a source file implies that it should be compiled with a C-Compiler. However the Math plugin is different in that respect because it actually needs a C++ compiler. The mingw32 C++ compiler is not directly
invoked but rather via "i586-mingw32msvc-gcc -xc++" for the source files of the Math plugin.

As a consequence name mangling (name decoration) occurs so that the DllMain function is no longer recognized as an entry function by the linker. This ultimately caused an access violation because the DllMain function provided by the Math plugin was not called and some values were not properly initialized. The access violation could be reproduced with the installer built from the math.nsi source (NSIS and its plugins built with mingw32): Run the installer (math.exe) and an access violation occurs just after you closed the window of the installer.

A detailed description including a proposed bug fix of the issue is available at the Sourceforge tracker:
sf.net/support/tracker.php?aid=2835731

I wonder if it would be better reverting to pure C for the Math plugin source files.


I've committed your change to SVN in r5998. Please close the bug, I don't appear to have permission to do so.


Thanks for applying the patch. I closed the bug.