I found using libraries generated by MinGW with Visual C++ will crash in some cases.
For example, this small program:
~~~~~~~~~~~~~~~~~~~~~~~t.h~~~~~~~~~~~~~~~~~~~
typedef struct
{
double x[2];
} s;
s t();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~t.c~~~~~~~~~~~~~~~~~~~
#include "t.h"
s t()
{
s s1;
return s1;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~main.c~~~~~~~~~~~~~~~~
#include "t.h"
int main()
{
t();
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First, compiling t.c to a library by MinGW:
gcc t.c -c ar r t.a t.o cp t.a t.lib
And compiling main.c and link to t.lib by Visual C++ 6.0 (I also tried Visual C++ 2008) in debug mode.
Finally, ran it. There displays an error message:
- For Visual C++ 6.0: http://p8.p.pixnet.net/albums/userpics/8/3/553683/1218663747.png [1]
- For Visual C++ 2008: http://p8.p.pixnet.net/albums/userpics/8/3/553683/1218663750.png [2]
Is this a MinGW's bug?
Shouldn't I use the libraries generated by MinGW with Visual C++ compilers?