Today, I encountered a strange problem.
Development Environment:
1. Eclipse CDT, using the gcc compiler and function library of MinGW
2. Visual Studio 2008
Problem description:
A dll is compiled using gcc in eclipse cdt. This dll contains a function that receives the FILE * parameter.
Thefunc (FILE *
After being compiled into a dll, you can use the thefunc function in the dll in MSVC to compile the SDK. However, when running the SDK, the memory cannot be written.
The following three calls have the same problem:
1.
# Include <stdio. h>
2.
# Include <stdio. h>
3.
# Include <stdio. h> * f = fopen (,
After repeated attempts, we found that:
1. dll and calling programs are compiled using gcc and can run normally.
2. The dll and the calling program are both compiled using vs2008 and can also run normally.
3. The dll is compiled with gcc, and the calling program is compiled with vs2008. The compilation is successful, but the memory is written.
4. Currently, most of the other functions in the dll compiled using gcc can be used normally in vs2008, but this FILE * type parameter may be involved.
Question:
The test program has been very simplified and can be ruled out as a logic issue in the code. But why is this gcc compiled dll available? Most functions can be used normally in vs2008, however, a FILE * type parameter may cause problems. Why? Is there a solution? Ask for advice on passing prawns.