The program uses the platform interoperability p/invoke to call the DLL of MFC in C #. programs can run normally in systems installed with the VS2008 development environment, but copying data to other machines won't work ,. net framewark is also the latest version. I don't know what to do.
A. dll is developed by someone else using VC6.0. It exports A class without source code.
B. dll is A packaging of A. dll. It is developed in VC ++ 2008. It packs member functions of the class into global functions and exports them.
C. dll is a package for B. dll. C # is developed. Use P/Invoke to call functions in B. dll.
D.exe is the final program that references C. dll
Later, depends.exe was used for analysis and found that B. dll in the Debug directory used MSVCR90D. dll. The strange thing is that this file cannot be found and can be run on the machine where VS is installed even if it cannot be found.
I checked some materials and found that MSVCR100.dll may have a BUG, which is also related to the compilation mode. So I used RELEASE to compile and solve the problem and run it everywhere.
Subsequent analysis using depends.exe found B in Release mode. the dll uses MSVCR90.dll, and end with a D missing. It should be the debugging version and the official version. at this time, I thought that there were a lot of DLL for debugging in the VS environment, and the DLL at the end of D was not included in the installation of the VC ++ 2008 package for MS, this causes the problem.
Therefore, do not worry about the release of the DEBUG version for users. I know many people have this habit. Bad habits !!! If you do not need to contact customer service early, you will pay a higher price later to find the problem.